chore: initial caddy compose with SPA and reverse proxy examples

This commit is contained in:
2026-05-12 03:36:38 +08:00
commit db54b58364
5 changed files with 61 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
services:
caddy:
image: caddy:latest
restart: unless-stopped
ports:
- 80:80
- 443:443
- 443:443/udp
volumes:
- ./volumes/Caddyfile:/etc/caddy/Caddyfile
- ./volumes/data:/data
- ./volumes/config:/config
networks:
default:
name: caddy
+11
View File
@@ -0,0 +1,11 @@
spa.example.com {
root * /srv/spa
encode zstd gzip
try_files {path} /index.html
file_server
}
app.example.com {
encode zstd gzip
reverse_proxy fullstack:3000
}
+2
View File
@@ -0,0 +1,2 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
+23
View File
@@ -0,0 +1,23 @@
services:
postgres:
image: postgres:18
restart: unless-stopped
ports:
- 5432:5432
volumes:
- ./volumes/data:/var/lib/postgresql
environment:
TZ: Asia/Shanghai
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 1s
timeout: 5s
retries: 10
networks:
default:
name: db
+9
View File
@@ -0,0 +1,9 @@
services:
watchtower:
image: nickfedor/watchtower:latest
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=Asia/Shanghai
command: --cleanup --interval 7200