diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b95b4ce --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file