# Adapted from: https://github.com/crowdsecurity/example-docker-compose/blob/main/caddy/Caddyfile # # the different stages of this Dockerfile are meant to be built into separate images # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose-file/#target # https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact ARG CADDY_VERSION=2 FROM caddy:${CADDY_VERSION}-builder-alpine AS builder RUN xcaddy build \ --with github.com/caddy-dns/cloudflare \ --with github.com/mholt/caddy-l4 \ --with github.com/caddyserver/transform-encoder \ --with github.com/hslatman/caddy-crowdsec-bouncer/http@main \ --with github.com/hslatman/caddy-crowdsec-bouncer/layer4@main FROM caddy:${CADDY_VERSION} AS caddy WORKDIR / COPY --from=builder /usr/bin/caddy /usr/bin/caddy