-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
50 lines (46 loc) · 2.57 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
VERSION 0.6
FROM golang:1.16-alpine
WORKDIR /app
project-files:
COPY go.mod go.sum .
COPY *.go .
COPY chain-registry ./chain-registry
build:
FROM +project-files
RUN go build -o dist/server
SAVE ARTIFACT dist/server dist/server AS LOCAL dist/server
docker:
ARG COSMOS_CHAIN_DIRECTORY_VERSION
ARG CHAIN_REGISTRY_VERSION
FROM alpine
ENV COSMOS_CHAIN_DIRECTORY_VERSION $COSMOS_CHAIN_DIRECTORY_VERSION
ENV CHAIN_REGISTRY_VERSION $CHAIN_REGISTRY_VERSION
WORKDIR /app
COPY +build/dist/server .
CMD [ "/app/server" ]
SAVE IMAGE --push empowergjermund/cosmos-chain-directory:$COSMOS_CHAIN_DIRECTORY_VERSION empowergjermund/cosmos-chain-directory:latest
deploy-to-akash:
ARG COSMOS_CHAIN_DIRECTORY_VERSION
ARG AKASH_DSEQ
ARG AKASH_PROVIDER
FROM ubuntu:20.04
WORKDIR /akash
COPY deploy.yml .
RUN sed -i 's/CHANGE_ME/'$COSMOS_CHAIN_DIRECTORY_VERSION'/' deploy.yml
ENV AKASH_HOME=/akash/.akash
ENV AKASH_KEY_NAME=AKASH_EARTHLY
RUN apt-get update -yq \
&& apt-get install --no-install-recommends -yq \
curl wget jq ca-certificates
RUN --secret GITHUB_TOKEN wget $(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/ovrclk/akash/releases/latest | jq -r ".assets[] | select(.name | test(\"linux_amd64.deb\")) | .browser_download_url") -O akash.deb
RUN dpkg -i akash.deb
RUN --secret AKASH_WALLET_KEY echo "$AKASH_WALLET_KEY" > key.key
RUN --secret AKASH_WALLET_KEY_PASSWORD echo "$AKASH_WALLET_KEY_PASSWORD" | akash keys import $AKASH_KEY_NAME key.key --keyring-backend test
RUN --secret AKASH_DEPLOY_CERTIFICATE echo "$AKASH_DEPLOY_CERTIFICATE" > $AKASH_HOME/$(akash keys show $AKASH_KEY_NAME --keyring-backend test --output=json | jq -r ".address").pem
RUN AKASH_VERSION="$(curl -s "https://raw.githubusercontent.com/ovrclk/net/master/mainnet/version.txt")" \
&& AKASH_CHAIN_ID="$(curl -s "https://raw.githubusercontent.com/ovrclk/net/master/mainnet/chain-id.txt")" \
&& AKASH_NODE=https://rpc.akash.forbole.com:443 \
&& echo $AKASH_VERSION $AKASH_NODE $AKASH_CHAIN_ID \
&& akash tx deployment update deploy.yml -y --dseq $AKASH_DSEQ --from $AKASH_KEY_NAME --keyring-backend test --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.5 \
&& sleep 30 \ # TODO: Do something smarter than this plz
&& akash provider send-manifest deploy.yml --node $AKASH_NODE --dseq $AKASH_DSEQ --provider $AKASH_PROVIDER --home $AKASH_HOME --from $AKASH_KEY_NAME --keyring-backend test