Add Dockerfile

This commit is contained in:
Adrien Reslinger 2018-11-07 17:42:45 +00:00
parent 54e1c64c63
commit 5abd4b7e5b

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM golang:1.11-alpine as builder
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN apk add -U --no-cache git build-base ca-certificates gcc git bash && \
mkdir -p /go/src/github.com/semihalev /data && \
cd /go/src/github.com/semihalev/ && \
git clone https://github.com/semihalev/sdns.git && \
cd /go/src/github.com/semihalev/sdns/ && \
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -v -o /go/bin/sdns .
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /data /data
COPY --from=builder /go/bin/sdns /app/
EXPOSE 53/udp 53 853 8053 8080
ENTRYPOINT ["/app/sdns"]
CMD ["-config", "/data/sdns.toml"]