Sign inSign up

mcmodersd/caddy-cloudflare

By mcmodersd

Updated about 4 hours ago

Custom Caddy build with Cloudflare DNS module for DNS-01 ACME challenges

Image
Networking
Web servers
0

904

mcmodersd/caddy-cloudflare repository overview

Custom Caddy build with the caddy-dns/cloudflare DNS provider module compiled in via xcaddy, based on caddy:latest-alpine.

Reusable, general-purpose reverse-proxy image — not tied to any one project:

  • No files are baked in. Bring your own Caddyfile at runtime (bind mount or Compose volume) — one image, any number of independent deployments.
  • The Cloudflare DNS module is additive. Skip the tls { dns cloudflare ... } directive in your Caddyfile and it behaves like plain Caddy with ordinary HTTP-01/TLS-ALPN certificates. Use the module when you need DNS-01 challenges — wildcard certs, or certs for hosts not reachable on ports 80/443.

Pull

docker pull mcmodersd/caddy-cloudflare:latest
# or
docker pull ghcr.io/mcmodersd/caddy-cloudflare:latest

Usage

services:
  caddy:
    image: mcmodersd/caddy-cloudflare:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    environment:
      CF_API_TOKEN: ${CF_API_TOKEN}
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
      - caddy_config:/config

volumes:
  caddy_data:
  caddy_config:

Example Caddyfile using DNS-01 (wildcard cert, no port 80/443 needed on the origin for issuance):

*.example.com {
    tls {
        dns cloudflare {env.CF_API_TOKEN}
    }
    reverse_proxy backend:8080
}

CF_API_TOKEN needs at least Zone:DNS:Edit scope for the target zone — create it at dash.cloudflare.com/profile/api-tokens.

Tag summary

Content type

Image

Digest

sha256:80d90c39d

Size

36.7 MB

Last updated

about 4 hours ago

docker pull mcmodersd/caddy-cloudflare