-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
38 lines (34 loc) · 1021 Bytes
/
docker-compose.yml
File metadata and controls
38 lines (34 loc) · 1021 Bytes
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
services:
frontend:
build: ./client # path to React + Vite dockerfile
ports:
- "3000:3000"
depends_on:
- backend
backend:
build: ./backend
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
environment:
- POSTGRES_URL=postgresql://postgres:postgres@db:5432/codesnippets
- BACKEND_CORS_ORIGIN=http://localhost:3000
db:
image: postgres:17-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/ # mounts or think of container data pointing to this volume
expose:
- 5432 # only for internal networking
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=codesnippets
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"] # check if postgres sql server is ready to accept connections for this user
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres_data: # creates empty managed docker volume for persistent storage