2022-08-11 01:03:17 +08:00
|
|
|
FROM golang:1.19.0-alpine3.16@sha256:0eb08c89ab1b0c638a9fe2780f7ae3ab18f6ecda2c76b908e09eb8073912045d AS build
|
2022-06-03 22:39:57 +08:00
|
|
|
|
2022-06-16 04:17:44 +08:00
|
|
|
WORKDIR /go/src/github.com/StackExchange/dnscontrol
|
|
|
|
|
|
|
|
ARG BUILD_VERSION
|
|
|
|
|
|
|
|
ENV GO111MODULE on
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# build dnscontrol
|
|
|
|
RUN apk update \
|
|
|
|
&& apk add --no-cache ca-certificates curl gcc build-base git \
|
|
|
|
&& update-ca-certificates \
|
|
|
|
&& go build -v -trimpath -buildmode=pie -ldflags="-s -w -X main.SHA=${BUILD_VERSION}"
|
|
|
|
|
|
|
|
# Validation check
|
|
|
|
RUN cp dnscontrol /go/bin/dnscontrol
|
|
|
|
RUN dnscontrol version
|
|
|
|
|
|
|
|
# -----
|
|
|
|
|
2022-08-11 01:02:13 +08:00
|
|
|
FROM alpine:3.16.2@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad
|
2022-06-16 04:17:44 +08:00
|
|
|
|
|
|
|
COPY --from=build /etc/ssl/certs /etc/ssl/certs
|
|
|
|
COPY --from=build /go/bin/dnscontrol /usr/local/bin
|
|
|
|
|
|
|
|
WORKDIR /dns
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/dnscontrol"]
|