-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
95 lines (91 loc) · 2.89 KB
/
docker-compose.yml
File metadata and controls
95 lines (91 loc) · 2.89 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
services:
# ==========================================================================
# PostgreSQL Database
# ==========================================================================
postgres:
image: postgres:15-alpine
container_name: nam-survey-postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: nam_survey
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- nam-survey-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# ==========================================================================
# Backend (NestJS + Prisma)
# ==========================================================================
backend:
build:
context: .
dockerfile: docker/backend.Dockerfile
target: development
container_name: nam-survey-backend
restart: unless-stopped
environment:
NODE_ENV: development
CI: "true"
DATABASE_URL: postgresql://postgres:password@postgres:5432/nam_survey?schema=public
FRONTEND_URL: http://localhost:3000
ports:
- "3001:3001"
volumes:
- ./apps/backend:/app
- backend_node_modules:/app/node_modules
depends_on:
postgres:
condition: service_healthy
networks:
- nam-survey-network
command: sh -c "pnpm install --no-frozen-lockfile && npx prisma generate && npx prisma migrate deploy && pnpm run start:dev"
# ==========================================================================
# Frontend (React + Vite)
# ==========================================================================
frontend:
build:
context: .
dockerfile: docker/frontend.Dockerfile
target: development
container_name: nam-survey-frontend
restart: unless-stopped
environment:
NODE_ENV: development
CI: "true"
BACKEND_URL: http://backend:3001
VITE_ADMIN_USERNAME: ${VITE_ADMIN_USERNAME:-admin}
VITE_ADMIN_PASSWORD: ${VITE_ADMIN_PASSWORD:-password}
ports:
- "3000:3000"
volumes:
- ./apps/frontend:/app
- frontend_node_modules:/app/node_modules
depends_on:
- backend
networks:
- nam-survey-network
command: sh -c "pnpm install --no-frozen-lockfile && pnpm run dev -- --host"
# ============================================================================
# Networks
# ============================================================================
networks:
nam-survey-network:
driver: bridge
# ============================================================================
# Volumes
# ============================================================================
volumes:
postgres_data:
driver: local
backend_node_modules:
driver: local
frontend_node_modules:
driver: local