diff --git a/caddy/Caddyfile b/caddy/Caddyfile new file mode 100644 index 0000000..1b74ae5 --- /dev/null +++ b/caddy/Caddyfile @@ -0,0 +1,9 @@ +{ + # Global option: Sets DNS-01 for all certificates using the Cloudflare plugin + acme_dns cloudflare {$CLOUDFLARE_API_TOKEN} +} + +ilboo.com { + # Forward requests to port 5003 running directly on the host system + reverse_proxy host.docker.internal:5003 +} diff --git a/caddy/Dockerfile b/caddy/Dockerfile new file mode 100644 index 0000000..3dce762 --- /dev/null +++ b/caddy/Dockerfile @@ -0,0 +1,8 @@ +FROM caddy:2-builder AS builder + +RUN xcaddy build \ + --with github.com/caddy-dns/cloudflare + +FROM caddy:2 + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy diff --git a/caddy/docker-compose.yml b/caddy/docker-compose.yml index 231bee2..e66fdc0 100644 --- a/caddy/docker-compose.yml +++ b/caddy/docker-compose.yml @@ -1,11 +1,15 @@ services: caddy: - image: caddy:latest + build: . restart: unless-stopped ports: - "80:80" - "443:443" - - "443:443/udp" + - "443:443/udp" # Enables HTTP/3 + env_file: + - .env + extra_hosts: + - "host.docker.internal:host-gateway" volumes: - ./Caddyfile:/etc/caddy/Caddyfile - caddy_data:/data @@ -16,3 +20,7 @@ services: volumes: caddy_data: caddy_config: + +networks: + caddy_net: + external: true diff --git a/caddy/example.env b/caddy/example.env new file mode 100644 index 0000000..d0d8501 --- /dev/null +++ b/caddy/example.env @@ -0,0 +1 @@ +CLOUDFLARE_API_TOKEN=your_actual_cloudflare_api_token_here