diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index b8f5576b92..009909c1ba 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -2,12 +2,20 @@ name: Publish Docker Image on: workflow_dispatch: + inputs: + vm_id: + description: 'The ID of the VM (binary dst in Docker image)' + default: '' + required: false + type: string + push: tags: - "*" branches: - master + jobs: publish_docker_image: name: Publish Docker Image @@ -19,4 +27,4 @@ jobs: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASS: ${{ secrets.DOCKER_PASS }} DOCKER_REPO: "avaplatform/subnet-evm" - run: .github/workflows/publish_docker_image.sh + run: .github/workflows/publish_docker_image.sh ${{ inputs.vm_id }} diff --git a/.github/workflows/publish_docker_image.sh b/.github/workflows/publish_docker_image.sh index b85c26409f..71bce26c12 100755 --- a/.github/workflows/publish_docker_image.sh +++ b/.github/workflows/publish_docker_image.sh @@ -15,6 +15,11 @@ SUBNET_EVM_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd ) # Load the versions source "$SUBNET_EVM_PATH"/scripts/versions.sh +# Set the vm id if provided +if [[ $# -eq 1 ]]; then + VM_ID=$1 +fi + # Buld the docker image source "$SUBNET_EVM_PATH"/scripts/build_docker_image.sh diff --git a/Dockerfile b/Dockerfile index c1b47fc376..72a8076f51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,4 +32,5 @@ RUN export SUBNET_EVM_COMMIT=$SUBNET_EVM_COMMIT && export CURRENT_BRANCH=$CURREN FROM avaplatform/avalanchego:$AVALANCHE_VERSION AS builtImage # Copy the evm binary into the correct location in the container -COPY --from=builder /build/build/subnet-evm /avalanchego/build/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy +ARG VM_ID +COPY --from=builder /build/build/subnet-evm /avalanchego/build/plugins/$VM_ID diff --git a/scripts/build_docker_image.sh b/scripts/build_docker_image.sh index fd0eff8597..1fe8efaefa 100755 --- a/scripts/build_docker_image.sh +++ b/scripts/build_docker_image.sh @@ -13,10 +13,17 @@ source "$SUBNET_EVM_PATH"/scripts/versions.sh # WARNING: this will use the most recent commit even if there are un-committed changes present BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${CURRENT_BRANCH}"} +DOCKERHUB_TAG=${SUBNET_EVM_COMMIT::8} + +VM_ID=${VM_ID:-"${DEFAULT_VM_ID}"} +if [[ "${VM_ID}" != "${DEFAULT_VM_ID}" ]]; then + DOCKERHUB_TAG="${VM_ID}-${DOCKERHUB_TAG}" +fi echo "Building Docker Image: $DOCKERHUB_REPO:$BUILD_IMAGE_ID based of AvalancheGo@$AVALANCHE_VERSION" -docker build -t "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" -t "$DOCKERHUB_REPO:${SUBNET_EVM_COMMIT::8}" \ +docker build -t "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" -t "$DOCKERHUB_REPO:${DOCKERHUB_TAG}" \ "$SUBNET_EVM_PATH" -f "$SUBNET_EVM_PATH/Dockerfile" \ --build-arg AVALANCHE_VERSION="$AVALANCHE_VERSION" \ --build-arg SUBNET_EVM_COMMIT="$SUBNET_EVM_COMMIT" \ - --build-arg CURRENT_BRANCH="$CURRENT_BRANCH" + --build-arg CURRENT_BRANCH="$CURRENT_BRANCH" \ + --build-arg VM_ID="$VM_ID" \ No newline at end of file