Skip to content

Commit

Permalink
chore: Update Dockerfile and README with Cloudflare DNS module integr…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
jkpe committed Aug 10, 2024
1 parent 0428eb0 commit 71fffa4
Showing 1 changed file with 90 additions and 2 deletions.
92 changes: 90 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,90 @@
# caddy-cloudflare
Caddy v2 with Caddy module: dns.providers.cloudflare
# Caddy with Cloudflare DNS Module

This repository contains a Dockerized version of Caddy v2 with the Cloudflare DNS provider module (`caddy-dns/cloudflare`). This setup enables automatic HTTPS with DNS-based challenge support, using Cloudflare as the DNS provider.

## Features

- **Automatic HTTPS**: Caddy automatically manages SSL/TLS certificates.
- **Cloudflare DNS Integration**: Easily manage DNS records through the Cloudflare API.
- **Dockerized**: Run Caddy in a container with a pre-built Cloudflare DNS module.
- **CI/CD with GitHub Actions**: Automated builds and deployments using GitHub Actions.
- **Automated Dependency Updates**: Keep dependencies up-to-date with Renovate.

## Getting Started

### Prerequisites

- Docker installed on your machine.
- A Cloudflare account and API token with DNS edit permissions.

### Clone the Repository

```bash
git clone https://github.com/jkpe/caddy-cloudflare.git
cd caddy-cloudflare
```

### Build the Docker Image

To build the Docker image locally:

```bash
docker build -t caddy-cloudflare .
```

### Run the Container

To run the container:

```bash
docker run -d -p 80:80 -p 443:443 \
-e CLOUDFLARE_API_TOKEN=your_cloudflare_api_token \
-v $(pwd)/Caddyfile:/etc/caddy/Caddyfile \
caddy-cloudflare
```

Replace `your_cloudflare_api_token` with your actual Cloudflare API token.

### Caddyfile Configuration

The `Caddyfile` is where you define your site's configuration. Below is a basic example:

```caddyfile
example.com {
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
reverse_proxy localhost:8080
}
```

This configuration:
- Sets up a site for `example.com`.
- Uses Cloudflare DNS to manage TLS certificates.
- Proxies requests to a local service running on port 8080.

## CI/CD with GitHub Actions

This repository includes a GitHub Actions workflow for building and publishing Docker images.

### Workflow Triggers

- **Push to Main**: Builds and publishes the Docker image.
- **Tag Creation**: Publishes a versioned Docker image.
- **Scheduled Builds**: Runs every day at a specified time (`cron`).

### Configuration

The workflow is configured to push images to the GitHub Container Registry (GHCR) by default. You can change the registry by modifying the `REGISTRY` and `IMAGE_NAME` environment variables in the workflow file.

## Automated Dependency Updates

This project uses Renovate to keep dependencies up-to-date automatically. The configuration is located in `renovate.json`, which extends the recommended settings provided by Renovate.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or bug fixes.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

0 comments on commit 71fffa4

Please sign in to comment.