-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cross-compile to avoid a lot of QEMU (#16)
- Loading branch information
1 parent
8eb4874
commit 5a24458
Showing
1 changed file
with
3 additions
and
2 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,4 +1,4 @@ | ||
FROM golang:1.16 | ||
FROM --platform=$BUILDPLATFORM golang:1.16 | ||
LABEL maintainer="Blake Covarrubias <[email protected]>" \ | ||
org.opencontainers.image.authors="Blake Covarrubias <[email protected]>" \ | ||
org.opencontainers.image.description="Advertises records for Kubernetes resources over multicast DNS." \ | ||
|
@@ -9,11 +9,12 @@ LABEL maintainer="Blake Covarrubias <[email protected]>" \ | |
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
ADD . /go/src/github.com/blake/external-mdns | ||
WORKDIR /go/src/github.com/blake/external-mdns | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=$(echo ${TARGETVARIANT} | cut -c2) \ | ||
go build \ | ||
-ldflags="-s -w" \ | ||
-o external-mdns . | ||
|