Skip to content

feat: Allow multi-arch image

When --platform flag is specified, Docker Engine fills the targeted architecture with these variables that can be used to generate an image.

For example, by running:

$ docker image build  --platform linux/arm64 --tag "$BUILD_IMAGE_NAME" --build-arg BASE_IMAGE=$BASE_IMAGE --build-arg TERRAFORM_BINARY_VERSION=$TERRAFORM_BINARY_VERSION .

The output is:

#4 [1/7] FROM docker.io/library/alpine:3.14.0@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
#4 sha256:250de2f6a9dea5135094c9b71b5664ddb0687cc9b3e2ef2fb69bddd8b89ca7ae
#4 resolve docker.io/library/alpine:3.14.0@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0 done

#5 [2/7] RUN apk add --no-cache jq curl git openssh
#5 sha256:9784fe06a68972fbbe16e15035e04065f7c28128cd408e4decf55a068ee643dc
#5 0.180 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/aarch64/APKINDEX.tar.gz
#5 0.980 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/aarch64/APKINDEX.tar.g

#7 [4/7] RUN ( curl -sLo terraform.zip "https://releases.hashicorp.com/terraform/1.0.0/terraform_1.0.0_linux_arm64.zip" &&       unzip terraform.zip &&       rm terraform.zip &&       mv ./terraform /usr/local/bin/terraform     ) && terraform --version
#7 sha256:ea46e0aea27df29141cc05539921f4ade614fbb895bceca8befb2cb1ddb0f0fb
#7 2.184 Archive:  terraform.zip
#7 4.994   inflating: terraform
#7 7.132 Terraform v1.0.0
#7 7.133 on linux_arm64
#7 DONE 7.2s

Unfortunately, the current dind image doesn't include the necessary plugin. So I would need to change .gitlab-ci.yml and I thought it would be too invasive. See issue and related PR.

I can refactor gitlab-ci.yml if necessary and update this MR.

fix #45 (closed)

Edited by willian.eth

Merge request reports