mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-06 07:03:45 +09:00
The golang builder images move to the 1.27.2 digests of their 1.27 tags, and the one image pinned to golang:1.27.1 moves to golang:1.27.2. Builds that reproduce an upstream release keep the Go that upstream uses. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
24 lines
666 B
Docker
24 lines
666 B
Docker
FROM --platform=$BUILDPLATFORM golang:1.27-alpine@sha256:f92b6ef800e499660581efdabdf25d9d817a9d124eaf900924f0504e7e27e12d AS builder
|
|
ARG GOPROXY
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN for attempt in 1 2 3; do GOOS=$TARGETOS GOARCH=$TARGETARCH go mod download && break; [ "$attempt" = 3 ] && exit 1; sleep $((attempt * 10)); done
|
|
|
|
COPY api api/
|
|
COPY pkg pkg/
|
|
COPY cmd cmd/
|
|
COPY internal internal/
|
|
|
|
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags="-extldflags=-static" -o /cozystack-api cmd/cozystack-api/main.go
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /cozystack-api /cozystack-api
|
|
|
|
ENTRYPOINT ["/cozystack-api"]
|