-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sylvain Rabot <[email protected]>
- Loading branch information
Showing
3 changed files
with
12 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
dist | ||
.go-build-flags | ||
.buildx-metadata.json |
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 |
---|---|---|
@@ -1,40 +1,14 @@ | ||
# vi: ft=Dockerfile: | ||
|
||
ARG GO_VERSION=1.22 | ||
|
||
FROM --platform=$BUILDPLATFORM golang:$GO_VERSION AS builder | ||
|
||
RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y build-essential git | ||
|
||
WORKDIR $GOPATH/src/sylr.dev/yage | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
FROM scratch | ||
|
||
ARG TARGETPLATFORM | ||
ARG VERSION | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
# Switch shell to bash | ||
SHELL ["bash", "-c"] | ||
|
||
# Run a git command otherwise git describe in the Makefile could report a dirty git dir | ||
RUN git diff --exit-code || true | ||
|
||
RUN make build GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${TARGETVARIANT/v/} GO_BUILD_TARGET=dist/${TARGETPLATFORM}/yage | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
FROM scratch | ||
|
||
ARG TARGETPLATFORM | ||
|
||
WORKDIR /usr/local/bin | ||
|
||
COPY --from=builder "/go/src/sylr.dev/yage/dist/$TARGETPLATFORM/yage" . | ||
COPY dist/yage-${VERSION}-${TARGETOS}-${TARGETARCH}${TARGETVARIANT} yage | ||
|
||
CMD ["/usr/local/bin/yage"] |
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