From c24d44fc9d8d64b8a81a6427ef7c475c3a9846d3 Mon Sep 17 00:00:00 2001 From: youben11 Date: Mon, 9 Oct 2023 12:37:33 +0100 Subject: [PATCH] ci: build/push docker images on tag push --- .github/workflows/publish_developer_image.yml | 14 ++++++++++ .../workflows/publish_docker_evmos_node.yml | 28 +++++++++++++++++-- docker/Dockerfile.evmos-node.developer | 10 ++++--- docker/Dockerfile.evmos-node.local | 5 ++-- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish_developer_image.yml b/.github/workflows/publish_developer_image.yml index b89d4906..d37ce077 100644 --- a/.github/workflows/publish_developer_image.yml +++ b/.github/workflows/publish_developer_image.yml @@ -8,6 +8,16 @@ on: default: "latest" type: string required: false + decryption_db_tag: + description: 'Decryption DB tag (default: latest)' + default: "latest" + type: string + required: false + tfhe_cli_tag: + description: 'TFHE CLI tag (default: latest)' + default: "latest" + type: string + required: false ref_to_evmos: description: 'Branch, tag or commit SHA1 to checkout Evmos' required: true @@ -64,6 +74,10 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: + build-arg: | + EVMOS_NODE_VERSION=${{ inputs.evmos_node_tag }} + DECRYPTION_DB_VERSION=${{ inputs.decryption_db_tag }} + TFHE_CLI_VERSION=${{ inputs.tfhe_cli_tag }} context: . file: docker/Dockerfile.evmos-node.developer push: true diff --git a/.github/workflows/publish_docker_evmos_node.yml b/.github/workflows/publish_docker_evmos_node.yml index dc72fa54..918503b3 100644 --- a/.github/workflows/publish_docker_evmos_node.yml +++ b/.github/workflows/publish_docker_evmos_node.yml @@ -1,6 +1,9 @@ name: Publish Evmos node on: + push: + tags: + - '*' workflow_dispatch: inputs: zbc_build_image_tag: @@ -30,6 +33,14 @@ jobs: with: path: evmos + - name: Use tag from workflow disptach (if workflow dispatch) + if: github.event_name == 'workflow_dispatch' + run: echo "EVMOS_TAG=${{ inputs.evmos_node_tag }}" >> $GITHUB_ENV + + - name: Use tag from tag push (if tag push) + if: github.event_name == 'push' && github.ref_type == 'tag' + run: echo "EVMOS_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV + - name: Get version for all needed repositories working-directory: ./evmos run: | @@ -107,12 +118,14 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: + build_args: | + ZBC_VERSION=${{ inputs.zbc_build_image_tag }} context: ./evmos file: ./evmos/docker/Dockerfile.evmos-node.local push: true pull: true platforms: linux/amd64,linux/arm64 - tags: ${{ env.DOCKER_IMAGE }}:${{ inputs.evmos_node_tag }},${{ env.DOCKER_IMAGE }}:latest + tags: ${{ env.DOCKER_IMAGE }}:$EVMOS_TAG,${{ env.DOCKER_IMAGE }}:latest labels: zbc-evmos-node - name: Check docker images @@ -120,5 +133,14 @@ jobs: run: | docker images - - + - name: Start build of dev image + shell: bash + env: + SECRET_TOKEN: ${{ secrets.CONCRETE_ACTIONS_TOKEN }} + run: | + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $SECRET_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/zama-ai/evmos/actions/workflows/publish_developer_image.yml/dispatches \ + -d '{"ref":"v9.1.0-zama","inputs":{"evmos_node_tag":"$EVMOS_TAG", "ref_to_evmos": "$EVMOS_TAG"}}' diff --git a/docker/Dockerfile.evmos-node.developer b/docker/Dockerfile.evmos-node.developer index 5404f8d0..9268c6e2 100644 --- a/docker/Dockerfile.evmos-node.developer +++ b/docker/Dockerfile.evmos-node.developer @@ -1,9 +1,11 @@ -FROM ghcr.io/zama-ai/fhevm-decryptions-db:v0.2.0 as oracle-env -FROM ghcr.io/zama-ai/fhevm-tfhe-cli:v0.2.0 as tfhe-cli - -FROM ghcr.io/zama-ai/evmos-node:v0.1.9 +ARG DECRYPTION_DB_VERSION=latest +ARG TFHE_CLI_VERSION=latest +ARG EVMOS_NODE_VERSION=latest +FROM ghcr.io/zama-ai/fhevm-decryptions-db:${DECRYPTION_DB_VERSION} as oracle-env +FROM ghcr.io/zama-ai/fhevm-tfhe-cli:${TFHE_CLI_VERSION} as tfhe-cli +FROM ghcr.io/zama-ai/evmos-node:${EVMOS_NODE_VERSION} WORKDIR /config diff --git a/docker/Dockerfile.evmos-node.local b/docker/Dockerfile.evmos-node.local index 64eb55b5..078b69bb 100644 --- a/docker/Dockerfile.evmos-node.local +++ b/docker/Dockerfile.evmos-node.local @@ -1,4 +1,5 @@ -FROM ghcr.io/zama-ai/zama-zbc-build:v0.1.3 AS build-env +ARG ZBC_VERSION=latest +FROM ghcr.io/zama-ai/zama-zbc-build:${ZBC_VERSION} AS build-env ENV LD_LIBRARY_PATH=/usr/lib/tfhe ADD . /src/evmos @@ -16,7 +17,7 @@ RUN ls /src/evmos RUN ls /src/evmos/build RUN mkdir -p /src/evmos/build -FROM ghcr.io/zama-ai/zama-zbc-build:v0.1.3 +FROM ghcr.io/zama-ai/zama-zbc-build:${ZBC_VERSION} RUN apt-get update -y RUN apt-get install ca-certificates jq -y