-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (115 loc) · 2.99 KB
/
Copy pathdocker-compose.yml
File metadata and controls
122 lines (115 loc) · 2.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Docker Compose for local development
# Usage: docker-compose up -d
#
# NOTE: This file is for LOCAL DEVELOPMENT ONLY. The postgres user/password
# (postgres/postgres) below are dev-only placeholders and must never be used in
# any shared or production environment.
services:
# Application server
app:
build:
context: .
dockerfile: Dockerfile
ports:
- '3000:3000'
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:postgres@db:5432/ucc_mca
- REDIS_URL=redis://redis:6379
# No insecure default: JWT_SECRET must be provided via the environment / .env.
- JWT_SECRET=${JWT_SECRET:?JWT_SECRET must be set (e.g. in a local .env file)}
- CORS_ORIGIN=http://localhost:5000,http://localhost:3000
- LOG_LEVEL=debug
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
# Mount source for development hot-reload
- ./src:/app/src:ro
- ./server:/app/server:ro
networks:
- ucc-network
restart: unless-stopped
# PostgreSQL Database
db:
image: postgres:15-alpine
ports:
- '5432:5432'
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=ucc_mca
volumes:
- postgres-data:/var/lib/postgresql/data
# Initialize with schema
- ./database/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres -d ucc_mca']
interval: 10s
timeout: 5s
retries: 5
networks:
- ucc-network
restart: unless-stopped
# Redis Cache
redis:
image: redis:7-alpine
ports:
- '6379:6379'
volumes:
- redis-data:/data
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 5s
retries: 5
networks:
- ucc-network
restart: unless-stopped
# Worker process for background jobs
worker:
build:
context: .
dockerfile: Dockerfile
command: ['node', 'dist/worker.cjs']
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:postgres@db:5432/ucc_mca
- REDIS_URL=redis://redis:6379
- LOG_LEVEL=debug
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- ucc-network
restart: unless-stopped
# Vite dev server for frontend (development only)
frontend:
build:
context: .
dockerfile: Dockerfile
target: deps
working_dir: /app
command: npm run dev -- --host 0.0.0.0
ports:
- '5000:5000'
environment:
- VITE_API_BASE_URL=http://localhost:3000/api
volumes:
- .:/app
- /app/node_modules
networks:
- ucc-network
profiles:
- development
volumes:
postgres-data:
redis-data:
networks:
ucc-network:
driver: bridge