Skip to content

Commit

Permalink
a bit more elegant
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed Feb 3, 2025
1 parent 1b42009 commit 6b7646d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} alpine:edge
FROM alpine:edge
LABEL maintainer="Ali Mosajjal <[email protected]>"

ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -12,7 +14,8 @@ RUN git clone https://${REPO}.git /opt/dnsmonster --depth 1 \
&& cd /opt/dnsmonster \
&& git fetch --tags \
&& export LATEST_TAG=`git describe --tags --always` \
&& GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build --ldflags "-L /usr/lib/libcap.a -linkmode external -X ${REPO}/util.releaseVersion=${LATEST_TAG} -extldflags \"-static\"" ./cmd/dnsmonster
&& export GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=1 \
&& go build --ldflags "-L /usr/lib/libcap.a -linkmode external -X ${REPO}/util.releaseVersion=${LATEST_TAG} -extldflags \"-static\"" ./cmd/dnsmonster

FROM scratch
COPY --from=0 /opt/dnsmonster/dnsmonster /dnsmonster
Expand Down

0 comments on commit 6b7646d

Please sign in to comment.