-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
28 lines (25 loc) · 1.02 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
# syntax=docker/dockerfile:labs
FROM --platform=${BUILDPLATFORM} golang:1.23.3-alpine3.20 AS build
ARG CLOUDFLARED_VERSION=2024.11.1
RUN apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates git build-base bash && \
git clone --recursive https://github.com/cloudflare/cloudflared --branch "$CLOUDFLARED_VERSION" /src && \
/src/.teamcity/install-cloudflare-go.sh && \
go version
ARG PATH="/tmp/go/bin:$PATH" \
CGO_ENABLED=0 \
TARGETARCH \
TARGETOS
RUN cd /src && \
go version && \
GOARCH="$TARGETARCH" GOOS="$TARGETOS" make -j "$(nproc)" cloudflared LINK_FLAGS="-s -w" && \
file /src/cloudflared
FROM alpine:3.20.3
RUN apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates tzdata tini curl
COPY --from=build /src/cloudflared /usr/local/bin/cloudflared
USER nobody
ENV NO_AUTOUPDATE=true
ENTRYPOINT ["tini", "--", "cloudflared", "--no-autoupdate", "--metrics", "localhost:9173"]
CMD ["tunnel", "run"]
HEALTHCHECK CMD curl -sI http://localhost:9173 -o /dev/null || exit 1