-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathDockerfile
22 lines (17 loc) · 815 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM alpine:edge
LABEL maintainer="Ali Mosajjal <[email protected]>"
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
ENV REPO="github.com/mosajjal/dnsmonster"
RUN apk add --no-cache libcap-static libpcap-dev linux-headers gcc git go file musl-dev --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/
RUN git clone https://${REPO}.git /opt/dnsmonster --depth 1 \
&& cd /opt/dnsmonster \
&& git fetch --tags \
&& export LATEST_TAG=`git describe --tags --always` \
&& 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
ENTRYPOINT ["/dnsmonster"]