I don’t see what’s complex about building from a Dockerfile. That’s very typical.
Just make a Dockerfile like this:
FROM caddy:2.3.0-builder AS builder
RUN xcaddy build \
--with github.com/greenpau/caddy-auth-jwt \
--with github.com/greenpau/caddy-auth-portal \
--with github.com/greenpau/caddy-trace
FROM caddy:2.3.0
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Save it beside your docker-compose.yml
, then update your docker-compose.yml
to this:
caddy:
build: .
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /data/caddy/Caddyfile:/etc/caddy/Caddyfile
- /data/caddy/data:/data
- /data/caddy/config:/config
networks:
- web
env_file:
- ~/.docker/compose/.env
Then run docker-compose up -d
, as normal. That’s it.