-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
63 lines (60 loc) · 1.81 KB
/
Copy pathdocker-compose.yml
File metadata and controls
63 lines (60 loc) · 1.81 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
version: '3.9'
services:
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-studyhabit}
POSTGRES_USER: ${DB_USER:-studyhabit}
POSTGRES_PASSWORD: ${DB_PASSWORD:?Set DB_PASSWORD in .env}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-studyhabit}"]
interval: 10s
retries: 5
timeout: 5s
api:
build: ./backend
restart: unless-stopped
ports:
- "3001:3001"
environment:
DATABASE_URL: postgresql://${DB_USER:-studyhabit}:${DB_PASSWORD}@db:5432/${DB_NAME:-studyhabit}
JWT_SECRET: ${JWT_SECRET:?Set JWT_SECRET in .env}
# JWT_REFRESH_SECRET is no longer used (refresh tokens are opaque), but
# kept here for backward-compat with existing .env files.
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-unused}
JWT_ACCESS_EXPIRY: ${JWT_ACCESS_EXPIRY:-15m}
JWT_REFRESH_EXPIRY: ${JWT_REFRESH_EXPIRY:-7d}
MAX_DEVICES_PER_USER: ${MAX_DEVICES_PER_USER:-5}
NODE_ENV: production
PORT: 3001
CORS_ORIGIN: ${CORS_ORIGIN:-https://studyhabit.schuelken.uk}
RATE_LIMIT_WINDOW_MS: ${RATE_LIMIT_WINDOW_MS:-900000}
RATE_LIMIT_MAX: ${RATE_LIMIT_MAX:-100}
depends_on:
db:
condition: service_healthy
required: false
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3001/health"]
interval: 10s
retries: 5
timeout: 5s
start_period: 30s
command: >
sh -c "npx prisma migrate deploy && node dist/index.js"
web:
build:
context: ./web
args:
VITE_API_URL: ${API_URL:-http://localhost:3001}
restart: unless-stopped
ports:
- "3000:3000"
depends_on:
api:
condition: service_healthy
volumes:
pgdata: