Skip to content

Commit

Permalink
doc: README and example
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdcdev committed Nov 12, 2023
1 parent 00eabeb commit 44921ae
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Contributing Guidelines

Contributions to this package are most welcome!

There is a test site in the solution to make working with this repository easier.
Contributions to this image are most welcome!
73 changes: 72 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,72 @@
# caddy-docker-proxy-cloudflare
# caddy-docker-proxy-cloudflare

[![Docker Image Version](https://img.shields.io/docker/v/jcdcdev/caddy-docker-proxy-cloudflare/latest)](https://hub.docker.com/r/jcdcdev/caddy-docker-proxy-cloudflare)
[![Docker Image Size](https://img.shields.io/docker/image-size/jcdcdev/caddy-docker-proxy-cloudflare/latest)](https://hub.docker.com/r/jcdcdev/caddy-docker-proxy-cloudflare)
[![GitHub issues](https://img.shields.io/github/issues/jcdcdev/caddy-docker-proxy-cloudflare)](https://github.com/jcdcdev/caddy-docker-proxy-cloudflare/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/jcdcdev/caddy-docker-proxy-cloudflare)](https://github.com/jcdcdev/caddy-docker-proxy-cloudflare/commits)
[![GitHub license](https://img.shields.io/github/license/jcdcdev/caddy-docker-proxy-cloudflare?color=8AB803)](../LICENSE)

## Description

This is a Docker image for using Caddy as a reverse proxy for Docker containers, allowing you to easily expose multiple services on one or many domain names with automatic HTTPS encryption using Cloudflare.

The image is based on the official Caddy Docker image and includes the following plugins

- [caddy-dns/cloudflare](https://github.com/caddy-dns/cloudflare)
- [caddy-docker-proxy](https://github.com/lucaslorentz/caddy-docker-proxy)

## Why?

I have a Raspberry pi running docker with many services and I want a clean way to get a https reverse proxy up and running _without_ opening port 80 to the world.

## Requirements

- Docker
- A domain name
- DNS must be managed by Cloudflare - [Guide](https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/)
- Cloudflare API key - [Guide](https://github.com/libdns/cloudflare#authenticating)

## Example Usage

Create a `docker-compose.yml` file with the following content:

```yml
version: "3.3"
networks:
frontend:
name: frontend
services:
# Caddy set up
caddy:
image: jcdcdev/caddy-docker-proxy-cloudflare:latest
ports:
- 80:80
- 443:443
networks:
- frontend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- '~/caddy/data:/data'
labels:
caddy: (cftls)
caddy.tls.dns: cloudflare "API-KEY-HERE"
caddy.tls.resolvers: 1.1.1.1
# Container that uses Caddy
who:
image: traefik/whoami
networks:
- frontend
labels:
caddy: who-am-i.my-domain.com
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.import: cftls
```
## Contributing
Contributions to this image are most welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md).
## Acknowledgments (thanks!)
- lucaslorentz - [caddy-docker-proxy](https://github.com/lucaslorentz/caddy-docker-proxy)
- caddy-dns - [caddy-dns/cloudflare](https://github.com/caddy-dns/cloudflare)
4 changes: 2 additions & 2 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
push: ${{ inputs.deploy == true }}
build-args: |
BUILD_VERSION=${{ env.SEMVER }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
create-release:
name: 🚀 create release
Expand Down
47 changes: 47 additions & 0 deletions docs/examples/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: "3.3"
networks:
frontend:
name: frontend
services:
# Caddy set up
caddy:
image: jcdcdev/caddy-docker-proxy-cloudflare:latest
ports:
- 80:80
- 443:443
networks:
- frontend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- '~/caddy/data:/data'
labels:
caddy: (cftls)
caddy.tls.dns: cloudflare "API-KEY-HERE"
caddy.tls.resolvers: 1.1.1.1
# Container that uses Caddy
who:
image: traefik/whoami
networks:
- frontend
labels:
caddy: who.example.com
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.import: cftls
# Container that uses Caddy
am:
image: traefik/whoami
networks:
- frontend
labels:
caddy: am.example.com
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.import: cftls
# Container that uses Caddy
i:
image: traefik/whoami
networks:
- frontend
labels:
caddy: i.example.com
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.import: cftls

0 comments on commit 44921ae

Please sign in to comment.