diff --git a/.github/workflows/it.yaml b/.github/workflows/it.yaml index 6a427d3f6..c35dd49bd 100644 --- a/.github/workflows/it.yaml +++ b/.github/workflows/it.yaml @@ -19,7 +19,7 @@ jobs: with: node-version: '16' - name: build devnet docker images - run: ./build-docker-images.sh "devnet" + run: ./build-docker-images.sh "devnet" "latest" - name: docker system prune run: docker system prune -f - name: start docker images @@ -44,22 +44,3 @@ jobs: if: success() || failure() uses: jwalton/gh-docker-logs@v2.2.1 # Next publish docker images after integration tests pass - publish: - needs: test - runs-on: ubuntu-20.04 - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - id: 'auth' - uses: 'google-github-actions/auth@v0' - with: - workload_identity_provider: projects/1004240933630/locations/global/workloadIdentityPools/github-pool/providers/github-provider - service_account: wormhole-fork-repo@alephium-org.iam.gserviceaccount.com - - name: auth docker - run: gcloud auth configure-docker - - name: build and push testnet docker images - run: ./build-docker-images.sh "testnet" true diff --git a/.github/workflows/publish-docker-images.yml b/.github/workflows/publish-docker-images.yml new file mode 100644 index 000000000..56c0f3000 --- /dev/null +++ b/.github/workflows/publish-docker-images.yml @@ -0,0 +1,47 @@ +name: Publish Docker Images + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + workflow_dispatch: + +jobs: + get_dist_tag: + runs-on: ubuntu-latest + outputs: + DIST_TAG: ${{ steps.get_tag.outputs.DIST_TAG }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: true + - name: Get the tag name + id: get_tag + run: | + tag=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-) + dist_tag=$([[ $tag =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo latest || echo "") + dist_tag=$([[ $tag =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ ]] && echo rc || echo $dist_tag) + [ -z "$dist_tag" ] && echo "Distribution tag is not set to latest nor to rc" && exit 1 + echo ::set-output name=DIST_TAG::$dist_tag + shell: bash + publish: + runs-on: ubuntu-20.04 + needs: get_dist_tag + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: 'auth' + uses: 'google-github-actions/auth@v0' + with: + workload_identity_provider: projects/1004240933630/locations/global/workloadIdentityPools/github-pool/providers/github-provider + service_account: wormhole-fork-repo@alephium-org.iam.gserviceaccount.com + - name: auth docker + run: gcloud auth configure-docker + - name: build and push testnet docker images + run: ./build-docker-images.sh "testnet" ${{ needs.get_dist_tag.outputs.DIST_TAG }} true diff --git a/build-docker-images.sh b/build-docker-images.sh index f86fc1394..dac58d97b 100755 --- a/build-docker-images.sh +++ b/build-docker-images.sh @@ -3,8 +3,8 @@ NETWORKS=('mainnet' 'testnet' 'devnet') network=$1 - -pushImage=${2:-false} +version=$2 +pushImage=${3:-false} if [ -z "${network// }" ] then @@ -14,7 +14,7 @@ fi set -euo pipefail xtrace -VERSION=0.2.121 +echo pushImage: $pushImage export DOCKER_BUILDKIT=1 @@ -26,7 +26,7 @@ else exit 1 fi -docker build -f ./docker/Dockerfile.init . -t eu.gcr.io/alephium-org/devnet-init:$VERSION +docker build -f ./docker/Dockerfile.init . -t eu.gcr.io/alephium-org/devnet-init:$version # Build proto-gen, generate node/pkg/proto dir docker build --target go-export -f ./docker/Dockerfile.proto -o type=local,dest=node . @@ -35,29 +35,29 @@ docker build --target go-export -f ./docker/Dockerfile.proto -o type=local,dest= docker build --target node-export -f ./docker/Dockerfile.proto -o type=local,dest=. . # Build guardian image (used for both guardian & spy) -docker build -f ./node/Dockerfile . -t eu.gcr.io/alephium-org/guardiand:$VERSION --build-arg network=$network +docker build -f ./node/Dockerfile . -t eu.gcr.io/alephium-org/guardiand:$version --build-arg network=$network ## Build eth-node image -docker build -f ./ethereum/Dockerfile . -t eu.gcr.io/alephium-org/eth-node:$VERSION +docker build -f ./ethereum/Dockerfile . -t eu.gcr.io/alephium-org/eth-node:$version -docker build -f ./alephium/Dockerfile . -t eu.gcr.io/alephium-org/alephium-contracts:$VERSION +docker build -f ./alephium/Dockerfile . -t eu.gcr.io/alephium-org/alephium-contracts:$version ## Build Bridge UI -docker build -f ./bridge_ui/Dockerfile . -t eu.gcr.io/alephium-org/bridge-ui-$network:$VERSION --build-arg network=$network +docker build -f ./bridge_ui/Dockerfile . -t eu.gcr.io/alephium-org/bridge-ui-$network:$version --build-arg network=$network ## Build Explorer Images ### explorer-api-server -docker build -f ./explorer-api-server/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-api-server:$VERSION +docker build -f ./explorer-api-server/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-api-server:$version ### explorer-backend -docker build -f ./explorer-backend/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-backend:$VERSION +docker build -f ./explorer-backend/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer-backend:$version ### explorer -docker build -f ./explorer/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer:$VERSION +docker build -f ./explorer/Dockerfile . -t eu.gcr.io/alephium-org/wormhole-explorer:$version if [ "${pushImage}" = true ] then - docker push eu.gcr.io/alephium-org/guardiand:$VERSION - docker push eu.gcr.io/alephium-org/bridge-ui-$network:$VERSION - docker push eu.gcr.io/alephium-org/wormhole-explorer:$VERSION + docker push eu.gcr.io/alephium-org/guardiand:$version + docker push eu.gcr.io/alephium-org/bridge-ui-$network:$version + docker push eu.gcr.io/alephium-org/wormhole-explorer:$version fi diff --git a/devnet.md b/devnet.md index d09b6f29d..3ac2cc7ec 100644 --- a/devnet.md +++ b/devnet.md @@ -12,7 +12,7 @@ Build the docker images: ```sh git clone git@github.com:alephium/wormhole-fork.git cd wormhole-fork/ -./build-docker-images.sh devnet +./build-docker-images.sh devnet latest ``` Start the devnet: diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 64897f5a7..7e8b2ae18 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -27,7 +27,7 @@ services: timeout: 45s alph-deploy-contracts: - image: eu.gcr.io/alephium-org/alephium-contracts:0.2.121 + image: eu.gcr.io/alephium-org/alephium-contracts:latest environment: NODE_URL: http://alephium:22973 depends_on: @@ -83,7 +83,7 @@ services: - EXPLORER_READONLY=false eth-devnet: - image: eu.gcr.io/alephium-org/eth-node:0.2.121 + image: eu.gcr.io/alephium-org/eth-node:latest restart: unless-stopped user: root ports: @@ -101,14 +101,14 @@ services: - --chainId=1338 eth-devnet-deploy-contracts: - image: eu.gcr.io/alephium-org/eth-node:0.2.121 + image: eu.gcr.io/alephium-org/eth-node:latest command: - /bin/sh - -c - "cd .. && git apply ./ethereum/1conf.patch && cd ethereum && CHAIN_NAME=ethereum npm run migrate -- --network ethDocker && npx truffle exec mine.js --network ethDocker" bsc-devnet: - image: eu.gcr.io/alephium-org/eth-node:0.2.121 + image: eu.gcr.io/alephium-org/eth-node:latest restart: unless-stopped user: root ports: @@ -126,14 +126,14 @@ services: - --chainId=1397 bsc-devnet-deploy-contracts: - image: eu.gcr.io/alephium-org/eth-node:0.2.121 + image: eu.gcr.io/alephium-org/eth-node:latest command: - /bin/sh - -c - "cd .. && git apply ./ethereum/1conf.patch && cd ethereum && CHAIN_NAME=bsc npm run migrate -- --network bscDocker && npx truffle exec mine.js --network bscDocker" devnet-init: - image: eu.gcr.io/alephium-org/devnet-init:0.2.121 + image: eu.gcr.io/alephium-org/devnet-init:latest environment: - NUM_OF_GUARDIANS=${NUM_OF_GUARDIANS:-1} command: @@ -142,7 +142,7 @@ services: - "/scripts/devnet-init.sh" guardian-0: - image: eu.gcr.io/alephium-org/guardiand:0.2.121 + image: eu.gcr.io/alephium-org/guardiand:latest hostname: guardian-0 restart: unless-stopped ports: @@ -181,7 +181,7 @@ services: - --logLevel=debug guardian-1: - image: eu.gcr.io/alephium-org/guardiand:0.2.121 + image: eu.gcr.io/alephium-org/guardiand:latest hostname: guardian-1 restart: unless-stopped ports: @@ -222,7 +222,7 @@ services: - --logLevel=debug guardian-2: - image: eu.gcr.io/alephium-org/guardiand:0.2.121 + image: eu.gcr.io/alephium-org/guardiand:latest hostname: guardian-2 restart: unless-stopped ports: @@ -263,7 +263,7 @@ services: - --logLevel=debug spy: - image: eu.gcr.io/alephium-org/guardiand:0.2.121 + image: eu.gcr.io/alephium-org/guardiand:latest restart: unless-stopped ports: - 127.0.0.1:7072:7072 @@ -317,7 +317,7 @@ services: ME_CONFIG_MONGODB_URL: ${ME_CONFIG_MONGODB_URL:-mongodb://mongo:27017/?directConnection=true} wormhole-explorer-backend: - image: eu.gcr.io/alephium-org/wormhole-explorer-backend:0.2.121 + image: eu.gcr.io/alephium-org/wormhole-explorer-backend:latest restart: unless-stopped ports: - 127.0.0.1:8101:8101 @@ -353,7 +353,7 @@ services: - ws://eth-devnet:8545 wormhole-explorer-api-server: - image: eu.gcr.io/alephium-org/wormhole-explorer-api-server:0.2.121 + image: eu.gcr.io/alephium-org/wormhole-explorer-api-server:latest restart: unless-stopped ports: - 127.0.0.1:8100:8100 @@ -373,13 +373,13 @@ services: - --enableStackTrace=true bridge-ui: - image: eu.gcr.io/alephium-org/bridge-ui-devnet:0.2.121 + image: eu.gcr.io/alephium-org/bridge-ui-devnet:latest restart: unless-stopped ports: - 127.0.0.1:30001:3000 wormhole-exporer: - image: eu.gcr.io/alephium-org/wormhole-explorer:0.2.121 + image: eu.gcr.io/alephium-org/wormhole-explorer:latest restart: unless-stopped ports: - 127.0.0.1:30002:8000