Skip to content

Commit

Permalink
Cross-compile to improve build times
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspj committed Jan 8, 2025
1 parent de1d8dc commit dbfd61c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dbfd61c

Please sign in to comment.