-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
51 lines (34 loc) · 1.2 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ARG GOLANG_VERSION=1.19
ARG ALPINE_VERSION=3.15
#Use a builder to build caddy with the DNS plugin
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} as build
ARG GOLANG_VERSION
ARG ALPINE_VERSION
WORKDIR /go/src/github.com/caddyserver/xcaddy/cmd/xcaddy
RUN apk add --no-cache git gcc build-base; \
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest;
RUN xcaddy build \
--output /go/src/github.com/caddyserver/xcaddy/cmd/caddy \
--with github.com/caddy-dns/cloudflare
#Final Image
FROM alpine:${ALPINE_VERSION}
ARG GOLANG_VERSION
ARG ALPINE_VERSION
#install tools
RUN apk add --no-cache ca-certificates curl netcat-openbsd jq yq tzdata bash docker-cli; \
rm -rf /var/cache/apk/*;
#Expose our ports!
EXPOSE 80 443
COPY --from=build /go/src/github.com/caddyserver/xcaddy/cmd/caddy /bin/
#fetch latest cloudflared
RUN curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 --output /cloudflared
RUN ["chmod", "+x", "/cloudflared"]
RUN mkdir /data; \
mkdir /services
#where caddy stores it's data
ENV XDG_DATA_HOME /data
COPY entrypoint.sh /
COPY services/* /services/
RUN ["chmod", "+x", "/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
CMD [""]