diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6254c34..e0a7494 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -37,6 +37,8 @@ jobs: # Workaround: https://github.com/docker/build-push-action/issues/461 - name: Setup Docker buildx uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} @@ -63,6 +65,7 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max # Sign the resulting Docker image digest except on PRs. diff --git a/Dockerfile b/Dockerfile index b8bc94d..35f184c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,43 @@ -FROM alpine:3.20.0 AS downloader +FROM alpine:3.20.0 AS setup-base RUN apk --no-cache add curl~=8 # renovate: datasource=github-releases depName=gruntwork-io/terragrunt ENV TERRAGRUNT_VERSION=v0.48.1 +# renovate: datasource=github-releases depName=transcend-io/terragrunt-atlantis-config +ENV TERRAGRUNT_ATLANTIS_CONFIG_VERSION=v1.18.0 + + + +# arm64-specific stage +FROM setup-base AS setup-arm64 + + +RUN curl -s -Lo terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_arm64 && \ + chmod +x terragrunt + +RUN wget -q https://github.com/transcend-io/terragrunt-atlantis-config/releases/download/${TERRAGRUNT_ATLANTIS_CONFIG_VERSION}/terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_arm64 && \ + mv terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_arm64 /terragrunt-atlantis-config + + +# amd64-specific stage +FROM setup-base AS setup-amd64 + RUN curl -s -Lo terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 && \ chmod +x terragrunt -FROM alpine:3.20.0 AS atlantis-config-installer +RUN wget -q https://github.com/transcend-io/terragrunt-atlantis-config/releases/download/${TERRAGRUNT_ATLANTIS_CONFIG_VERSION}/terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_amd64 && \ + mv terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_amd64 /terragrunt-atlantis-config -# renovate: datasource=github-releases depName=transcend-io/terragrunt-atlantis-config -ENV TERRAGRUNT_ATLANTIS_CONFIG_VERSION=v1.16.0 + + +FROM setup-${TARGETARCH} AS terragrunt-setup # hadolint ignore=SC3057 -RUN wget -q "https://github.com/transcend-io/terragrunt-atlantis-config/releases/download/${TERRAGRUNT_ATLANTIS_CONFIG_VERSION}/terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_amd64.tar.gz" && \ - tar -xzvf terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_amd64.tar.gz && \ - mv terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_amd64/terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG_VERSION:1}_linux_amd64 /terragrunt-atlantis-config FROM ghcr.io/runatlantis/atlantis:v0.28.1 -COPY --from=downloader /terragrunt /usr/local/bin/terragrunt -COPY --from=atlantis-config-installer /terragrunt-atlantis-config /usr/local/bin/terragrunt-atlantis-config +COPY --from=terragrunt-setup /terragrunt /usr/local/bin/terragrunt +COPY --from=terragrunt-setup /terragrunt-atlantis-config /usr/local/bin/terragrunt-atlantis-config USER root # renovate: datasource=repology depName=alpine_3_19/awscli versioning=loose diff --git a/README.md b/README.md index c622248..3e85977 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,8 @@ Builds our atlantis image containing terragrunt. Adds the [terragrunt](https://github.com/gruntwork-io/terragrunt) and [aws-cli](https://aws.amazon.com/cli/) binaries to the [official atlantis image](https://github.com/runatlantis/atlantis) + +> [!NOTE] +> This image is built as a multi-arch image for `amd64` and `arm64`. +> We set up a stage for each platform in the Dockerfile and updated the `docker/setup-buildx-action` and `docker/build-push-action` accordingly. +> To build locally, you might need to set up a multi-arch builder for docker buildx.