-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
70 lines (67 loc) · 2.59 KB
/
docker-compose.yml
File metadata and controls
70 lines (67 loc) · 2.59 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
version: '3.9'
services:
# ── Next.js Application ──────────────────────────────────────────────────────
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3003:3000"
env_file:
- .env
environment:
NODE_ENV: production
# Internal URL — app talks to the db container within the Docker network
# Public URL for external tools: postgresql://postgres:password123@76.13.180.29:6434/lmsdb?sslmode=disable
DATABASE_URL: postgresql://postgres:${DB_PASSWORD:-password123}@db:5432/${DB_NAME:-lmsdb}?sslmode=disable
volumes:
# Persist uploaded files across container restarts and redeployments
- uploads_data:/app/public/uploads
# Persist Nemo AI memory across restarts
- nemo_data:/app/data
restart: unless-stopped
depends_on:
db:
condition: service_healthy
# ── PostgreSQL Database ───────────────────────────────────────────────────────
db:
image: postgres:17-alpine
# Pass admin credentials as GUC variables so 02-init-admin.sql can read them
# List format avoids shell quoting issues with the inner -c values
command:
- postgres
- -c
- app.admin_email=${ADMIN_EMAIL:-admin@example.com}
- -c
- app.admin_password=${ADMIN_PASSWORD:-password123}
- -c
- app.admin_name=${ADMIN_FULL_NAME:-System Administrator}
- -c
- app.company_name=${COMPANY_NAME:-Chelsea Academia Pte Ltd}
- -c
- app.partner_uen=${TRAINING_PARTNER_UEN:-201509271W}
environment:
POSTGRES_DB: ${DB_NAME:-lmsdb}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_PASSWORD:-password123}
volumes:
# Persist data across container restarts
- postgres_data:/var/lib/postgresql/data
# Both scripts run automatically on first start (empty volume only)
- ./database/01-schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
- ./database/02-init-admin.sql:/docker-entrypoint-initdb.d/02-init-admin.sql
ports:
# 6434 = public port on the server (e.g. 76.13.180.29:6434)
# 5432 = internal postgres port inside the container
- "6434:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d ${DB_NAME:-lmsdb}"]
interval: 10s
timeout: 5s
retries: 15
start_period: 30s
restart: unless-stopped
volumes:
postgres_data:
uploads_data:
nemo_data: