multi-architecture-dockerfile-updates #228

Manually merged
argoyle merged 2 commits from multi-architecture-dockerfile-updates into main 2026-01-19 10:09:44 +00:00
+7 -4
View File
@@ -1,9 +1,12 @@
FROM golang:1.25.6@sha256:fc24d3881a021e7b968a4610fc024fba749f98fe5c07d4f28e6cfa14dc65a84c as deps
FROM golang:1.25.6@sha256:fc24d3881a021e7b968a4610fc024fba749f98fe5c07d4f28e6cfa14dc65a84c AS deps
WORKDIR /build
ADD go.* /build
RUN go mod download
FROM deps as build
FROM deps AS build
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0
ADD . /build
RUN if [ $(go mod tidy -v 2>&1 | grep -c unused) != 0 ]; then echo "Unused modules, please run 'go mod tidy'"; exit 1; fi
@@ -14,9 +17,9 @@ RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v -f <(find . -type f | xa
RUN go tool cover -html=coverage.txt -o coverage.html
RUN go tool cover -func=coverage.txt
RUN rm coverage.txt.tmp
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=readonly -o release/default-request-adder -ldflags '-w -s'
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -mod=readonly -o release/default-request-adder -ldflags '-w -s'
FROM scratch as export
FROM scratch AS export
COPY --from=build /build/coverage.txt /
FROM scratch