-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
118 lines (112 loc) · 3.15 KB
/
docker-compose.yml
File metadata and controls
118 lines (112 loc) · 3.15 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
services:
####################### React App #######################
pims-app-v2:
tty: true
restart: "no"
container_name: pims-app-v2
build:
context: react-app
ports:
- ${APP_HTTP_PORT:-3000}:3000
depends_on:
- pims-api-v2
env_file: .env
networks:
- pims
####################### Express API #######################
pims-api-v2:
restart: "no"
container_name: pims-api-v2
build:
context: express-api
env_file:
- .env
ports:
- ${API_HTTP_PORT:-5000}:5000
depends_on:
- postgres
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/api/v2/health"]
interval: 300s
timeout: 10s
retries: 3
networks:
- pims
####################### Postgres #######################
postgres:
container_name: postgres
image: postgres:17.5
restart: unless-stopped
env_file:
- .env
environment:
PGDATA: /var/lib/postgresql/data
volumes:
- postgres_data:/var/lib/postgresql/data # Named volumes persist on "down" with Podman
- ./database/postgres:/backup # A local mount to place dump files for restore/export
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER} || exit 1",
]
interval: 5s
timeout: 3s
networks:
- pims
####################### Hotloading Dev Containers #######################
pims-app-dev:
tty: true
restart: "no"
image: node:22.9-bullseye-slim
container_name: pims-app-dev
volumes:
- ./react-app:/app
- app_node_modules:/app/node_modules # Use named volume to persist node_modules
working_dir: /app
ports:
- ${APP_HTTP_PORT:-3000}:3000
environment:
- CONTAINERIZED=true # So it targets container directly
- API_PROXY=http://pims-api-dev:5000
- WATCHPACK_POLLING=true # Enable polling for file changes
- CHOKIDAR_USEPOLLING=true # Enable polling for Vite/React dev servers
- FAST_REFRESH=true # Ensure fast refresh is enabled
env_file: .env
command: sh -c "npm install && npm run dev"
networks:
- pims
pims-api-dev:
tty: true
restart: "no"
image: node:22.9-bullseye-slim
container_name: pims-api-dev
volumes:
- ./express-api:/app
- api_node_modules:/app/node_modules # Use named volume to persist node_modules
working_dir: /app
ports:
- ${API_HTTP_PORT:-5000}:5000
environment:
- CONTAINERIZED=true # So it targets container directly
- POSTGRES_PORT=5432 # Must be for internal network
- CHOKIDAR_USEPOLLING=true
env_file: .env
command: sh -c "npm install && npx nodemon --exec ts-node -r tsconfig-paths/register ./src/server.ts"
networks:
- pims
####################### Networks Definition #######################
networks:
pims:
name: pims-net
driver: bridge
####################### Volumes Definition #######################
volumes:
postgres_data:
name: postgres_data
app_node_modules:
name: app_node_modules
api_node_modules:
name: api_node_modules