This commit is contained in:
James Turland 2025-02-24 23:02:04 +00:00
parent 4f456ff838
commit 9d973c4823
5 changed files with 76 additions and 0 deletions

2
Caddy/.env Normal file
View File

@ -0,0 +1,2 @@
CF_API_TOKEN=1ufPvdNumd2MJd9jBQmPSPLRweLu_VrNgcW1shxy
CF_EMAIL=your@email.com

32
Caddy/Caddyfile Normal file
View File

@ -0,0 +1,32 @@
{
admin 0.0.0.0:2019
}
*.jimsgarage.co.uk {
tls {
dns cloudflare {env.CF_API_TOKEN}
propagation_delay 2m
resolvers 1.1.1.1
}
@caddy host caddy.jimsgarage.co.uk
handle @caddy {
root * /usr/share/caddy
php_fastcgi localhost:80
file_server
}
@trueNAS host truenas.jimsgarage.co.uk
handle @trueNAS {
reverse_proxy 192.168.6.2:80
}
@portainer host caddy-portainer.jimsgarage.co.uk
handle @portainer {
reverse_proxy https://portainer:9443 {
transport http {
tls
tls_insecure_skip_verify
}
}
}

8
Caddy/Dockerfile Normal file
View File

@ -0,0 +1,8 @@
# For prod you'd want to pin the version: e.g., 2.9.1-builder
FROM caddy:builder AS builder
RUN xcaddy build \
--with github.com/caddy-dns/cloudflare
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

33
Caddy/docker-compose.yaml Normal file
View File

@ -0,0 +1,33 @@
services:
caddy:
build:
context: .
dockerfile: Dockerfile
container_name: caddy
restart: unless-stopped
env_file:
- .env
environment:
- CLOUDFLARE_EMAIL=${CF_EMAIL}
- CLOUDFLARE_API_TOKEN=${CF_API_TOKEN}
- ACME_AGREE=true
ports:
- 2019:2019 # remove if you do not want admin API
- 80:80
- 443:443
volumes:
- caddy-config:/config
- caddy-data:/data
- ./Caddyfile:/etc/caddy/Caddyfile
- ./index.html:/usr/share/caddy/index.html
networks:
- caddy # add other containers onto this network to use dns name
volumes:
caddy-config:
caddy-data:
# create this first before running the docker-compose - docker network create caddy
networks:
caddy:
external: true

1
Caddy/index.html Normal file
View File

@ -0,0 +1 @@
hello