forked from klutchell/dnscrypt-proxy-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (22 loc) · 1.04 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM golang:1.17.2-alpine as build
WORKDIR /go/src/github.com/DNSCrypt/dnscrypt-proxy/
COPY VERSION .
ARG ARCHIVE_URL=https://github.com/DNSCrypt/dnscrypt-proxy/archive/
ENV CGO_ENABLED 0
# hadolint ignore=DL3018
RUN apk add --no-cache ca-certificates curl \
&& curl -L "${ARCHIVE_URL}$(head -n1 VERSION).tar.gz" -o /tmp/dnscrypt-proxy.tar.gz \
&& tar xzf /tmp/dnscrypt-proxy.tar.gz --strip 1 -C /go/src/github.com/DNSCrypt \
&& go build -v -ldflags="-s -w"
WORKDIR /config
RUN cp -a /go/src/github.com/DNSCrypt/dnscrypt-proxy/example-* ./
COPY dnscrypt-proxy.toml ./
# ----------------------------------------------------------------------------
FROM scratch
COPY --from=build /etc/passwd /etc/group /etc/
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /go/src/github.com/DNSCrypt/dnscrypt-proxy/dnscrypt-proxy /usr/local/bin/
COPY --from=build --chown=nobody:nogroup /config /config
USER nobody
ENTRYPOINT ["dnscrypt-proxy", "-config", "/config/dnscrypt-proxy.toml"]
RUN ["dnscrypt-proxy", "-version"]