-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (25 loc) · 947 Bytes
/
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
# Dockerfile for building the project with static assets
FROM --platform=$BUILDPLATFORM golang:1.23-bullseye AS build
WORKDIR /goapp
ARG TARGETOS TARGETARCH
ARG CADDY_VERSION=latest
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
xcaddy build ${CADDY_VERSION} \
--with github.com/pberkel/caddy-storage-redis \
--with github.com/caddy-dns/cloudflare \
--with github.com/lucaslorentz/caddy-docker-proxy/v2
# Now copy it into our base image.
FROM alpine:latest AS alpine
EXPOSE 80 443 443/udp 2019
ENV XDG_CONFIG_HOME=/config
ENV XDG_DATA_HOME=/data
RUN apk add -U --no-cache ca-certificates curl
COPY --from=build /goapp/caddy /bin/caddy
ENTRYPOINT ["/bin/caddy"]
CMD ["docker-proxy"]