Skip to content

Commit

Permalink
Cross-compile to avoid a lot of QEMU (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stelminator authored and iamasmith committed Mar 10, 2024
1 parent 8eb4874 commit 5a24458
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
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." \
Expand All @@ -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 .
Expand Down

0 comments on commit 5a24458

Please sign in to comment.