From 4a7bb723e87046e85934fc69b2139cc13e43048f Mon Sep 17 00:00:00 2001 From: Lukas Peter Aldershaab Date: Wed, 8 Jan 2025 13:14:04 +0100 Subject: [PATCH 1/2] Cross-compile to improve build times Signed-off-by: Lukas Peter Aldershaab --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed8d0b5fe7..665a062f6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,11 @@ ARG DEFAULT_CONFTEST_VERSION=0.56.0 # Stage 1: build artifact and download deps -FROM golang:${GOLANG_TAG} AS builder +FROM --platform=$BUILDPLATFORM golang:${GOLANG_TAG} AS builder + +# These are automatically populated by Docker +ARG TARGETOS +ARG TARGETARCH ARG ATLANTIS_VERSION=dev ENV ATLANTIS_VERSION=${ATLANTIS_VERSION} @@ -42,7 +46,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \ COPY . /app RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ - CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X 'main.version=${ATLANTIS_VERSION}' -X 'main.commit=${ATLANTIS_COMMIT}' -X 'main.date=${ATLANTIS_DATE}'" -v -o atlantis . + CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "-s -w -X 'main.version=${ATLANTIS_VERSION}' -X 'main.commit=${ATLANTIS_COMMIT}' -X 'main.date=${ATLANTIS_DATE}'" -v -o atlantis . FROM debian:${DEBIAN_TAG} AS debian-base @@ -155,7 +159,7 @@ COPY --from=deps /usr/bin/git-lfs /usr/bin/git-lfs COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh # renovate: datasource=repology depName=alpine_3_21/ca-certificates versioning=loose -ENV CA_CERTIFICATES_VERSION="20241010" +ENV CA_CERTIFICATES_VERSION="20241121" # Install packages needed to run Atlantis. # We place this last as it will bust less docker layer caches when packages update From 1c26a1aab238cf27b49f42660df9bba8fbc4c2a2 Mon Sep 17 00:00:00 2001 From: Lukas Peter Aldershaab Date: Wed, 8 Jan 2025 13:18:37 +0100 Subject: [PATCH 2/2] Undo change to ca-certificates Signed-off-by: Lukas Peter Aldershaab --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 665a062f6c..f7c86979b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -159,7 +159,7 @@ COPY --from=deps /usr/bin/git-lfs /usr/bin/git-lfs COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh # renovate: datasource=repology depName=alpine_3_21/ca-certificates versioning=loose -ENV CA_CERTIFICATES_VERSION="20241121" +ENV CA_CERTIFICATES_VERSION="20241010" # Install packages needed to run Atlantis. # We place this last as it will bust less docker layer caches when packages update