20 lines
539 B
Text
20 lines
539 B
Text
FROM golang:latest AS builder
|
|
|
|
# Enable Go Modules and force Go proxy usage
|
|
ENV GO111MODULE=on
|
|
ENV GOPROXY=https://proxy.golang.org,direct
|
|
|
|
# Install xcaddy
|
|
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
|
|
|
|
# Build Caddy with required plugins
|
|
RUN xcaddy build \
|
|
--with github.com/lucaslorentz/caddy-docker-proxy/v2 \
|
|
--with github.com/crowdsecurity/caddy-bouncer
|
|
|
|
# Create a lightweight final image
|
|
FROM caddy:latest
|
|
|
|
# Copy built Caddy binary from the builder stage
|
|
COPY --from=builder /go/bin/caddy /usr/bin/caddy
|
|
|