-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (78 loc) · 2.01 KB
/
docker-compose.yml
File metadata and controls
82 lines (78 loc) · 2.01 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
services:
# Database Tier - PostgreSQL
database:
image: postgres:15-alpine
container_name: taskapp_db
environment:
POSTGRES_DB: taskmanager
POSTGRES_USER: taskuser
POSTGRES_PASSWORD: taskpass123
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- taskapp_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U taskuser -d taskmanager"]
interval: 10s
timeout: 5s
retries: 5
# Application Tier - Node.js API
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: taskapp_api
environment:
NODE_ENV: production
PORT: 3001
DB_HOST: database
DB_PORT: 5432
DB_NAME: taskmanager
DB_USER: taskuser
DB_PASSWORD: taskpass123
HOST_IP: ${HOST_IP:-localhost}
FRONTEND_URL: http://${HOST_IP:-localhost}:3000
ports:
- "3001:3001"
depends_on:
database:
condition: service_healthy
volumes:
- ./backend/src:/app/src
- ./backend/server.js:/app/server.js
- ./backend/healthcheck.js:/app/healthcheck.js
networks:
- taskapp_network
restart: unless-stopped
# Presentation Tier - React Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
REACT_APP_API_URL: http://${HOST_IP:-localhost}:3001
container_name: taskapp_web
environment:
REACT_APP_API_URL: http://${HOST_IP:-localhost}:3001
CHOKIDAR_USEPOLLING: "true"
HOST: 0.0.0.0
# Secure host configuration - only allow specific hosts
ALLOWED_HOSTS: ${HOST_IP:-localhost},localhost,127.0.0.1,0.0.0.0
ports:
- "3000:3000"
depends_on:
- backend
volumes:
- ./frontend/src:/app/src
- ./frontend/public:/app/public
networks:
- taskapp_network
restart: unless-stopped
volumes:
postgres_data:
networks:
taskapp_network:
driver: bridge