-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (32 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
48 lines (32 loc) · 1.22 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
# Build container
FROM golang:alpine AS buildstage
ARG CLOUDFLARED_TAG
RUN mkdir -p /root-layer/cloudflared
WORKDIR /src
RUN apk --no-cache add git build-base curl jq
ENV GO111MODULE=on \
CGO_ENABLED=0
RUN \
if [ -z "${CLOUDFLARED_TAG}" ]; then \
curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest \
| jq -rc ".tag_name" \
| xargs -I TAG sh -c 'git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch TAG .'; \
else \
git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch ${CLOUDFLARED_TAG} .; \
fi
RUN GOOS=linux GOARCH=amd64 make cloudflared
RUN mv cloudflared /root-layer/cloudflared/cloudflared-amd64
RUN GOOS=linux GOARCH=arm64 make cloudflared
RUN mv cloudflared /root-layer/cloudflared/cloudflared-arm64
RUN GOOS=linux GOARCH=arm make cloudflared
RUN mv cloudflared /root-layer/cloudflared/cloudflared-armhf
COPY root/ /root-layer/
## Single layer deployed image ##
FROM alpine:3.14
RUN apk add --no-cache bash curl jq
# Add files from buildstage
COPY --from=buildstage /root-layer/ /
COPY run.sh /run.sh
COPY config.yaml /config.yaml
RUN chmod +x /run.sh
ENTRYPOINT ["/run.sh"]