File tree Expand file tree Collapse file tree 2 files changed +26
-16
lines changed
Expand file tree Collapse file tree 2 files changed +26
-16
lines changed Original file line number Diff line number Diff line change 5555 platforms : ${{ env.PLATFORMS }}
5656 endpoint : builders
5757
58+ - uses : actions/setup-go@v5
59+ with :
60+ go-version-file : go.mod
61+
62+ - name : build binaries
63+ run : |
64+ set -eux
65+
66+ targets=()
67+
68+ IFS=',' read -ra platforms <<< "${{ env.PLATFORMS }}"
69+ for platform in "${platforms[@]}"; do
70+ targets+=("build-${platform%%/*}-${platform##*/}")
71+ done
72+
73+ make build_all BUILD_TARGETS="${targets[@]}"
74+
5875 - name : Build OCI image
5976 uses : docker/build-push-action@v6
6077 with :
Original file line number Diff line number Diff line change 1- FROM golang:1.24.2 AS builder
2-
3- ARG TARGETOS=linux
4- ARG TARGETARCH=amd64
5- ARG REVISION=unknown
1+ FROM gcr.io/distroless/static:nonroot
62
7- WORKDIR /app
8- COPY go.mod .
9- COPY go.sum .
10- RUN go mod download
3+ # TARGETOS and TARGETARCH are automatically set by buildkit if `--platform` is passed
4+ # https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#automatic-platform-args-in-the-global-scope
5+ ARG TARGETOS
6+ ARG TARGETARCH
117
12- COPY cmd/ cmd/
13- COPY internal/ internal/
14- COPY *.go .
8+ ARG REVISION=unknown
159
16- RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -ldflags= "-X github.com/FeLvi-zzz/tentez.Revision=${REVISION}" -o tentez ./cmd/tentez/main.go
10+ WORKDIR /
1711
18- FROM gcr.io/distroless/static:nonroot
12+ # NOTE: require the pre-built binaries in dist/
13+ COPY dist/tentez-${TARGETOS}-${TARGETARCH} /tentez
1914
2015LABEL org.opencontainers.image.title="FeLvi-zzz/tentez"
2116
22- WORKDIR /
23- COPY --from=builder /app/tentez /tentez
2417USER 65532:65532
2518
2619ENTRYPOINT ["/tentez" ]
You can’t perform that action at this time.
0 commit comments