-
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.
- Loading branch information
1 parent
d9f32a1
commit 6c275d1
Showing
2 changed files
with
19 additions
and
8 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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
# BUILD | ||
FROM golang:alpine as builder | ||
# use the build platforms matching arch rather than target arch | ||
FROM --platform=$BUILDPLATFORM golang:alpine as builder | ||
|
||
ARG TARGETARCH | ||
|
||
WORKDIR /go | ||
|
||
COPY dispatcher.go . | ||
RUN go build dispatcher.go | ||
|
||
# build for the target arch not the build platform host arch | ||
RUN GOOS=linux GOARCH=$TARGETARCH go build dispatcher.go | ||
|
||
# RUN | ||
FROM alpine | ||
# defaults to using the target arch image | ||
FROM scratch as run | ||
|
||
COPY --from=builder /go/dispatcher /dispatcher | ||
COPY static /static/ | ||
|
||
EXPOSE 80 | ||
CMD ["/dispatcher"] | ||
|
||
COPY --from=builder /go/dispatcher / | ||
COPY static /static/ | ||
CMD ["/dispatcher"] |