-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add runners for each platform and xx support.
Note platform support currently broken (tags don't exist). Signed-off-by: Adrian Mouat <adrian@chainguard.dev>
- Loading branch information
Showing
2 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Load cross-platform helper functions | ||
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx | ||
|
||
FROM --platform=$BUILDPLATFORM cgr.dev/chainguard/go:latest-dev AS builder | ||
COPY --from=xx / / | ||
RUN xx-apk add --no-cache zlib-dev | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
WORKDIR /work | ||
|
||
COPY go.mod /work/ | ||
COPY cmd /work/cmd | ||
COPY internal /work/internal | ||
|
||
# See https://mt165.co.uk/blog/static-link-go/ for creating static binaries | ||
#RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o hello ./cmd/server | ||
RUN CGO_ENABLED=0 xx-go build -o hello ./cmd/server | ||
|
||
FROM cgr.dev/chainguard/static | ||
COPY --from=builder /work/hello /hello | ||
|
||
ENTRYPOINT ["/hello"] |