-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
84 lines (79 loc) · 2.17 KB
/
docker-compose.yml
File metadata and controls
84 lines (79 loc) · 2.17 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
services:
postgres:
image: postgres:${POSTGRES_VERSION}
container_name: postgres_db
restart: always
env_file:
- .env
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_NAME}
- NODE_ENV=${NODE_ENV}
ports:
- "${DB_PORT}:5432" # Format: HOST_PORT:CONTAINER_PORT
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- my_network
healthcheck: # Added healthcheck
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
retries: 5
pgadmin:
image: dpage/pgadmin4:${PGADMIN_VERSION}
container_name: pgadmin
restart: always
env_file:
- .env
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
ports:
- "${PGADMIN_PORT}:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
depends_on:
postgres: # Changed depends_on for pgadmin to use condition
condition: service_healthy
networks:
- my_network
backend:
build:
context: ./app/backend
dockerfile: Dockerfile
container_name: backend_app
restart: always
env_file:
- .env
ports:
- "${BE_PORT}:3000" # Map host BE_PORT to container 3000
volumes:
- ./app/backend/logs:/app/logs # Mount logs directory
# Optional: Mount source code for development (remove for production image)
# - ./app/backend:/app
# - /app/node_modules # Prevent host node_modules from overwriting container's
depends_on:
postgres: # Changed depends_on for backend to use condition
condition: service_healthy
networks:
- my_network
frontend:
build:
context: .
dockerfile: app/frontend/Dockerfile
container_name: frontend_app
restart: always
ports:
- "${FE_PORT}:80" # Map host FE_PORT to container 80 (Nginx)
depends_on:
- backend # Frontend depends on backend for API calls
networks:
- my_network
volumes:
postgres_data:
pgadmin_data:
networks:
my_network:
driver: bridge # Explicitly define bridge network