This repository provides a pre-built Caddy Docker image with Cloudflare DNS plugin included. It is designed to make SSL certificate automation and reverse proxy setup fast, reliable, and reproducible.
Key goals:
- Automatic SSL/TLS using Let's Encrypt
- Cloudflare DNS integration for ACME challenges
- Prebuilt Docker image for ARM64 and x86_64 architectures
- Open for contributions to improve features, workflows, and Docker setup
- Automatic HTTPS: Caddy automatically provisions and renews SSL certificates.
- Cloudflare DNS integration: Use Cloudflare API to complete DNS-01 challenges automatically.
- Prebuilt Docker image: No need to manually compile Caddy with the Cloudflare plugin.
- ARM64 support: Works seamlessly on Oracle Ampere, Raspberry Pi, and other ARM64 devices.
- Self-hosted CI/CD: Built with GitHub Actions, cached for faster builds.
- Open Contribution: Contributions are welcome via PRs.
The recommended way to run the container is via Docker Compose:
services:
caddy:
image: ghcr.io/lewsion/caddy-cloudflare:latest
container_name: caddy-cloudflare
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "2019:2019"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
environment:
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
volumes:
data:
config:You can provide environment variables in a .env file (e.g., env.example) to configure Caddy:
# Cloudflare API Token for DNS challenges
# Get this from: https://dash.cloudflare.com/profile/api-tokens
# Required permissions: Zone:Zone:Read, Zone:DNS:Edit
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token_hereTip: Copy
env.exampleto.envand set your values. Docker Compose will automatically pick them up.
A basic Caddyfile to get started:
yourdomain.com {
tls {
dns cloudflare
}
reverse_proxy localhost:8080
}
- Replace
yourdomain.comwith your domain. - Ensure
CLOUDFLARE_API_TOKENis set in your environment for DNS-01 challenge automation.
docker pull ghcr.io/lewsion/caddy-cloudflare:latest- latest: Always points to the latest stable build.
- SHA tags: Immutable versions for reproducibility (
ghcr.io/lewsion/caddy-cloudflare:<commit-sha>).
Contributions are always welcome! You can help by:
- Fixing bugs or typos
- Improving the Dockerfile or workflows
- Adding features or plugins
- Enhancing documentation
Steps to contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/awesome-feature. - Make your changes.
- Submit a pull request to the
mainbranch.
Please ensure your contributions follow the workflow, Docker build practices, and coding standards of this repository.
- GitHub Actions automatically builds and pushes Docker images to GHCR.
- Dependabot keeps Docker base images and GitHub Actions up-to-date.
- Builds are cached for speed, tested on ARM64 and x86_64 architectures.
MIT License – free to use, modify, and distribute.
Maintained by Lewsion