forked from homeall/caddy-reverse-proxy-cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (27 loc) · 1.19 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
ARG GOLANG_VERSION=1.23.3
ARG ALPINE_VERSION=3.20
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS gobuild
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/[email protected]
ENV CGO_ENABLED=0
ENV CADDY_VERSION=v2.9.0
RUN xcaddy build \
--output /go/src/github.com/caddyserver/xcaddy/cmd/caddy \
--with github.com/lucaslorentz/caddy-docker-proxy/[email protected] \
--with github.com/caddy-dns/[email protected] \
--with github.com/WeidiDeng/[email protected] \
--with github.com/hslatman/caddy-crowdsec-bouncer/[email protected]
WORKDIR /go/src/healthcheck
COPY healthcheck.go .
RUN go build -o /healthcheck -ldflags="-s -w" healthcheck.go
FROM gcr.io/distroless/static-debian12:nonroot
EXPOSE 80 443 2019
ENV XDG_CONFIG_HOME=/config
ENV XDG_DATA_HOME=/data
COPY --from=gobuild /go/src/github.com/caddyserver/xcaddy/cmd/caddy /bin/
COPY --from=gobuild /healthcheck /bin/
USER nonroot:nonroot
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s CMD ["/bin/healthcheck"]
ENTRYPOINT ["/bin/caddy"]
CMD ["docker-proxy"]