-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
63 lines (61 loc) · 1.99 KB
/
docker-compose.yml
File metadata and controls
63 lines (61 loc) · 1.99 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
services:
backend:
image: ghcr.io/btreemap/csc309:latest
# Or build locally:
# build:
# context: ./backend
# dockerfile: Dockerfile
container_name: csc309-backend
restart: unless-stopped
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- JWT_SECRET=${JWT_SECRET:?JWT_SECRET is required}
# Database: SQLite (default) or PostgreSQL
# For SQLite:
- DATABASE_URL=file:/app/data/database.db
# For PostgreSQL (uncomment and set your connection string):
# - DATABASE_URL=postgresql://postgres:password@postgres:5432/csc309?schema=public
# Backend URL for absolute URLs (e.g., avatar images)
- BACKEND_URL=${BACKEND_URL:-http://localhost:3000}
# CORS: Set to your frontend URL (e.g., https://your-app.pages.dev)
- FRONTEND_URL=${FRONTEND_URL:-http://localhost:5173}
# Auto-migrate: Set to "true" to run migrations on startup
- AUTO_MIGRATE=${AUTO_MIGRATE:-true}
volumes:
# Persist SQLite database (not needed when using PostgreSQL)
- backend-data:/app/data
# Persist uploaded files
- backend-uploads:/app/uploads
# Uncomment when using PostgreSQL:
# depends_on:
# postgres:
# condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Uncomment to use PostgreSQL instead of SQLite:
# postgres:
# image: postgres:16-alpine
# container_name: csc309-postgres
# restart: unless-stopped
# environment:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: password
# POSTGRES_DB: csc309
# volumes:
# - postgres-data:/var/lib/postgresql/data
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U postgres"]
# interval: 10s
# timeout: 5s
# retries: 5
volumes:
backend-data:
backend-uploads:
# Uncomment when using PostgreSQL:
# postgres-data: