-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (56 loc) · 2.76 KB
/
Dockerfile
File metadata and controls
74 lines (56 loc) · 2.76 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM ghcr.io/jauderho/golang:1.26.0-alpine3.23@sha256:3c6dcf80ba83ce8f7622e61118cedbef38353daf78d524342ea12b385f931e63 AS build
WORKDIR /go/src/github.com/cloudflare/cloudflared/
ARG BUILD_VERSION
ARG ARCHIVE_URL=https://github.com/cloudflare/cloudflared/archive/
ENV GO111MODULE on
ENV CGO_ENABLED 0
RUN test -n "${BUILD_VERSION}" \
&& apk update \
&& apk upgrade -a \
&& apk add --no-cache ca-certificates curl gcc build-base bind-tools libcap \
&& update-ca-certificates \
&& curl -L "${ARCHIVE_URL}${BUILD_VERSION}.tar.gz" -o /tmp/cloudflared.tar.gz \
&& tar xzf /tmp/cloudflared.tar.gz --strip 1 -C /go/src/github.com/cloudflare/cloudflared \
#&& go get -u github.com/cloudflare/circl github.com/go-jose/go-jose/v3 google.golang.org/protobuf \
#&& go get -u github.com/coredns/coredns \
#&& go get -u github.com/quic-go/quic-go \
#&& go get -u golang.org/x/crypto golang.org/x/net \
&& go mod tidy \
&& go mod vendor \
&& go build -o cloudflared -v -trimpath -ldflags="-s -w -X main.Version=${BUILD_VERSION}" ./cmd/cloudflared/ \
&& adduser -S cloudflared \
&& mkdir /etc/cloudflared
# Validation check
#RUN cp cloudflared /go/bin/cloudflared
#RUN setcap CAP_NET_BIND_SERVICE+eip cloudflared
RUN ./cloudflared -v
# ----------------------------------------------------------------------------
#FROM scratch
FROM ghcr.io/jauderho/alpine:3.23.3@sha256:350bc73d1a938d40605f8ecd1009be511e61804d8452af018d63b8eac931fe33
# LABEL org.opencontainers.image.authors="Jauder Ho <jauderho@users.noreply.github.com>"
# LABEL org.opencontainers.image.url="https://github.com/jauderho/dockerfiles"
# LABEL org.opencontainers.image.documentation="https://github.com/jauderho/dockerfiles"
# LABEL org.opencontainers.image.source="https://github.com/jauderho/dockerfiles"
# LABEL org.opencontainers.image.title="jauderho/cloudflared"
# LABEL org.opencontainers.image.description="Command line client for Cloudflare's Argo Tunnel"
RUN apk update \
&& apk upgrade -a
COPY --from=build /etc/passwd /etc/group /etc/cloudflared /etc/
COPY --from=build /etc/ssl/certs /etc/ssl/certs
COPY --from=build /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/cloudflared
#RUN setcap CAP_NET_BIND_SERVICE+eip /usr/local/bin/cloudflared
# EXPOSE
# Default to Cloudflare and Quad9
ENV DNS1 1.1.1.1
ENV DNS2 9.9.9.9
ENV UPSTREAM1 https://${DNS1}/dns-query
ENV UPSTREAM2 https://${DNS2}/dns-query
ENV PORT 5454
ENV ADDRESS 0.0.0.0
ENV METRICS 127.0.0.1:8888
# STOPSIGNAL
HEALTHCHECK NONE
#HEALTHCHECK --interval=5s --timeout=3s --start-period=5s CMD nslookup -po=${PORT} cloudflare.com 127.0.0.1 || exit 1
USER cloudflared
ENTRYPOINT ["/usr/local/bin/cloudflared"]
CMD ["proxy-dns --address ${ADDRESS} --port ${PORT} --metrics ${METRICS} --upstream ${UPSTREAM1} --upstream ${UPSTREAM2} --no-autoupdate"]