-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
99 lines (94 loc) · 3.07 KB
/
Copy pathdocker-compose.yml
File metadata and controls
99 lines (94 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# ─────────────────────────────────────────────────────────────────────────────
# DerList Production Docker Compose
#
# Usage:
# cp .env.example .env (fill in secrets)
# docker compose up
#
# The app service automatically:
# 1. Waits for PostgreSQL to be healthy
# 2. Runs pending Prisma migrations
# 3. Seeds the database with an owner account (first run only)
# 4. Starts the Next.js server
# ─────────────────────────────────────────────────────────────────────────────
services:
# ── PostgreSQL ──
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-derlist}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
POSTGRES_DB: ${POSTGRES_DB:-derlist}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-derlist} -d ${POSTGRES_DB:-derlist}"]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
networks:
- derlist
# ── DerList Application ──
app:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER:-derlist}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-derlist}"
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
NODE_ENV: production
AUTH_SECRET: ${AUTH_SECRET:-}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID:-}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET:-}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-}
PROVIDER_ENCRYPTION_KEY: ${PROVIDER_ENCRYPTION_KEY:-}
ADMIN_EMAIL: ${ADMIN_EMAIL:-}
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-}
ADMIN_USERNAME: ${ADMIN_USERNAME:-}
ADMIN_DISPLAY_NAME: ${ADMIN_DISPLAY_NAME:-}
volumes:
- uploads:/app/uploads
ports:
- "${APP_PORT:-3000}:3000"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000/api/health"]
interval: 30s
timeout: 5s
start_period: 45s
retries: 3
networks:
- derlist
# ── Caddy Reverse Proxy (optional — activate with: docker compose --profile with-caddy up) ──
caddy:
image: caddy:2-alpine
restart: unless-stopped
profiles:
- with-caddy
depends_on:
app:
condition: service_healthy
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
networks:
- derlist
volumes:
pgdata:
uploads:
caddy_data:
caddy_config:
networks:
derlist:
driver: bridge