2022-04-08 08:45:27 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:1.17.1 as build
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ARG BUILDPLATFORM
|
|
|
|
|
2020-05-29 01:06:27 +00:00
|
|
|
ENV GO111MODULE=on \
|
2022-04-08 08:45:27 +00:00
|
|
|
CGO_ENABLED=0
|
|
|
|
|
|
|
|
ENV FIPS=false
|
2019-12-17 01:25:17 +00:00
|
|
|
|
2019-04-29 21:25:34 +00:00
|
|
|
WORKDIR /go/src/github.com/cloudflare/cloudflared/
|
2019-12-17 01:25:17 +00:00
|
|
|
|
2022-04-08 08:45:27 +00:00
|
|
|
# build with github tags
|
|
|
|
#ADD https://github.com/cloudflare/cloudflared/archive/refs/tags/2022.4.0.zip
|
|
|
|
|
2019-04-29 21:25:34 +00:00
|
|
|
COPY . .
|
2019-12-17 01:25:17 +00:00
|
|
|
|
|
|
|
# compile cloudflared
|
2022-04-08 08:45:27 +00:00
|
|
|
RUN set -e \
|
|
|
|
&& echo "Running on $BUILDPLATFORM, building for $TARGETPLATFORM" \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install --no-install-recommends -y ruby \
|
|
|
|
&& ruby docker-env.rb
|
|
|
|
|
|
|
|
FROM --platform=$TARGETPLATFORM alpine:edge
|
|
|
|
COPY --from=build /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/cloudflared
|
2019-04-29 21:25:34 +00:00
|
|
|
|
2022-04-08 08:45:27 +00:00
|
|
|
RUN set -e \
|
|
|
|
&& apk add --no-cache ca-certificates nano
|
2019-12-17 01:25:17 +00:00
|
|
|
|
2022-04-08 08:45:27 +00:00
|
|
|
WORKDIR /root
|
2019-12-17 01:25:17 +00:00
|
|
|
|
2022-04-08 08:45:27 +00:00
|
|
|
# ref: https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/dns-over-https-client/
|
|
|
|
EXPOSE 53/udp
|
|
|
|
# ref: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/configuration/ports-and-ips/
|
|
|
|
EXPOSE 443
|
|
|
|
EXPOSE 7844
|
2019-12-17 01:25:17 +00:00
|
|
|
|
2022-04-08 08:45:27 +00:00
|
|
|
# Don't set entrypoint, user need edit config file
|
|
|
|
CMD ["/bin/sh"]
|