mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-09 18:06:42 +00:00
The default images for Go sets GOTOOLCHAIN=local which forces builds to use the bundled Go version. Setting this to auto allows for upgrading to a newer version if specified by the toolchain directive in go.mod. Useful for situations where the latest Go Docker image lags behind the latest Go version.
18 lines
389 B
Docker
18 lines
389 B
Docker
FROM --platform=$BUILDPLATFORM golang:1.22 as builder
|
|
ENV CGO_ENABLED=0
|
|
ENV GOTOOLCHAIN=auto
|
|
WORKDIR /src
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make wonderwall
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
WORKDIR /app
|
|
COPY --from=builder /src/bin/wonderwall /app/wonderwall
|
|
ENTRYPOINT ["/app/wonderwall"]
|