2.2K
Prebuilt Caddy image with:
Images are published to:
melonsmasher/caddy-cloudflare-cacheghcr.io/melonsmasher/caddy-cloudflare-cache-alpine variants, e.g.:
:2, :2-alpine:2.7.6, :2.7.6-alpinegithub.com/caddy-dns/cloudflaregithub.com/WeidiDeng/caddy-cloudflare-ipgithub.com/darkweak/souin/plugins/caddydocker pull melonsmasher/caddy-cloudflare-cache:2docker pull melonsmasher/caddy-cloudflare-cache:2-alpinedocker pull ghcr.io/melonsmasher/caddy-cloudflare-cache:2docker pull ghcr.io/melonsmasher/caddy-cloudflare-cache:2-alpineCaddyfile in your working directory.docker run -d --name caddy \
-p 80:80 -p 443:443 \
-v "$(pwd)/Caddyfile:/etc/caddy/Caddyfile:ro" \
-v caddy_data:/data \
-v caddy_config:/config \
melonsmasher/caddy-cloudflare-cache:2
services:
caddy:
image: melonsmasher/caddy-cloudflare-cache:2
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
environment:
# Cloudflare API token for DNS-01 challenge
CLOUDFLARE_API_TOKEN: "your_token"
# Only needed if using static trusted proxies
# CADDY_TRUSTED_PROXIES: "1.2.3.4/32 5.6.7.8/32"
volumes:
caddy_data:
caddy_config:
# Global options
{
servers {
# Set client IP headers
client_ip_headers CF-Connecting-IP X-Real-IP X-Forwarded-For Client-IP X-Client-IP
# Set trusted proxies to Cloudflare addresses
trusted_proxies cloudflare {
# Pull the Cloudflare IP addresses from the Cloudflare API every x hours
interval 12h
# Set timeout for the Cloudflare API request
timeout 15s
}
# Add static trusted proxies if needed
#trusted_proxies static {$CADDY_TRUSTED_PROXIES}
}
}
example.com {
root * /srv/www
file_server
# Souin plugin basic enablement with Redis storage
# See https://github.com/darkweak/souin for more details
cache {
redis {
url redis:6379
}
}
# DNS-01 via Cloudflare
tls {
dns cloudflare {$CLOUDFLARE_API_TOKEN}
# Set custom resolvers if needed
#resolvers 1.1.1.1 8.8.8.8
# Set custom propagation timeout if needed
#propagation_timeout 15m
}
}
CLOUDFLARE_API_TOKEN with suitable permissions for DNS-01.tls block in your Caddyfile.github.com/caddy-dns/cloudflare for all supported variables and token scopes.github.com/WeidiDeng/caddy-cloudflare-ipsouin { ... } block inside your site.github.com/darkweak/souin docs for full configuration.See scripts/README.md for details on how images are built and mirrored from upstream tags.
/data: ACME certs and state/config: Caddy config storageUse volumes or host mounts so certs persist across container restarts.
tls block.souin block is present and that your routes/methods/headers match the cache rules.Content type
Image
Digest
sha256:bdbd0160b…
Size
39.6 MB
Last updated
11 months ago
docker pull melonsmasher/caddy-cloudflare-cache:2.10.2-alpine