-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (40 loc) · 1.66 KB
/
Dockerfile
File metadata and controls
55 lines (40 loc) · 1.66 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
FROM busybox:1.37.0-uclibc@sha256:23deb35184aeb204224e6307f9c82a26f87059a5c9f476c797ba28f357e5df6d as busybox
FROM alpine:3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 as cloudflared
# Dockerfile cross compilation helper
FROM tonistiigi/xx@sha256:c64defb9ed5a91eacb37f96ccc3d4cd72521c4bd18d5442905b95e2226b0e707 AS xx
# Stage - Build Cloudflared
FROM golang:1.20-alpine@sha256:e47f121850f4e276b2b210c56df3fda9191278dd84a3a442bfe0b09934462a8f as builder
# Copy xx scripts
COPY --from=xx / /
WORKDIR /src
ARG TARGETPLATFORM
ENV GO111MODULE=on
ENV CGO_ENABLED=0
# renovate: datasource=github-releases depName=cloudflare/cloudflared
ARG CLOUDFLARED_VERSION=2023.10.0
RUN apk --update --no-cache add git \
&& \
# Git clone specify cloudflared version
git clone --branch ${CLOUDFLARED_VERSION} https://github.com/cloudflare/cloudflared . \
&& \
# Build cloudflared
xx-go build -v -mod=vendor -trimpath -o /bin/cloudflared \
-ldflags="-w -s -X 'main.Version=${CLOUDFLARED_VERSION}' -X 'main.BuildTime=${BUILDTIME}'" \
./cmd/cloudflared \
&& \
# Verify cloudflared
xx-verify --static /bin/cloudflared
# Stage - Main Image
FROM gcr.io/distroless/base-debian11@sha256:ac69aa622ea5dcbca0803ca877d47d069f51bd4282d5c96977e0390d7d256455
# Copy Cloudflare binary to image
COPY --from=builder --chown=nonroot /bin/cloudflared /usr/local/bin/cloudflared
# Copy shell, tail into image
COPY --from=busybox /bin/sh /bin/tail /bin/
# Copy entrypoint
COPY --chown=nonroot entrypoint.sh .
# Add nonroot user
USER nonroot
# Tunnel environments
ENV TUNNEL_TOKEN=noToken
ENV POST_QUANTUM=false
ENTRYPOINT [ "/bin/sh", "entrypoint.sh" ]