-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
86 lines (82 loc) · 3.18 KB
/
Copy pathdocker-compose.yml
File metadata and controls
86 lines (82 loc) · 3.18 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
name: codown
services:
# ─────────────────────────────────────────
# PostgreSQL
# ─────────────────────────────────────────
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-codown}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
POSTGRES_DB: ${POSTGRES_DB:-codown}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-codown} -d ${POSTGRES_DB:-codown} && psql -U ${POSTGRES_USER:-codown} -d ${POSTGRES_DB:-codown} -c 'SELECT 1' > /dev/null 2>&1",
]
interval: 10s
timeout: 5s
retries: 10
start_period: 15s
# ─────────────────────────────────────────
# Express API + Hocuspocus WS
# ─────────────────────────────────────────
server:
build:
context: .
dockerfile: server/Dockerfile
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
NODE_ENV: production
PORT: ${SERVER_PORT:-5000}
# Individual DB vars (used by server's env validation)
POSTGRES_USER: ${POSTGRES_USER:-codown}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB:-codown}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_HOST: db
# Prisma also needs DATABASE_URL
DATABASE_URL: postgresql://${POSTGRES_USER:-codown}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-codown}
# JWT — using the names your server validation expects
JWT_ACCESS_SECRET: ${JWT_ACCESS_SECRET:?JWT_ACCESS_SECRET is required}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:?JWT_REFRESH_SECRET is required}
SHARE_LINK_SECRET: ${SHARE_LINK_SECRET:?SHARE_LINK_SECRET is required}
# Server code reads CLIENT_BASE for building share links
CLIENT_BASE: ${CLIENT_URL:-http://localhost}
ports:
- "${SERVER_PORT:-5000}:${SERVER_PORT:-5000}"
healthcheck:
test:
[
"CMD-SHELL",
"wget -qO- http://localhost:${SERVER_PORT:-5000}/health || exit 1",
]
interval: 15s
timeout: 5s
retries: 3
start_period: 20s
# ─────────────────────────────────────────
# React SPA served by Nginx
# ─────────────────────────────────────────
client:
build:
context: .
dockerfile: client/Dockerfile
args:
VITE_APP_API_URL: ${VITE_API_URL:-http://localhost:5000}
VITE_APP_SOCKET_URL: ${VITE_WS_URL:-ws://localhost:5000}
restart: unless-stopped
depends_on:
server:
condition: service_healthy
ports:
- "${CLIENT_PORT:-80}:80"
volumes:
postgres_data: