-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
45 lines (43 loc) · 1.04 KB
/
docker-compose.yml
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
services:
app:
container_name: todolistapp
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/todolistdb
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
networks:
- todolist-network
db:
container_name: postgresdb
image: postgres:16.4-alpine3.20
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: todolistdb
networks:
- todolist-network
healthcheck:
# Use the CMD-SHELL command to check the health
test: ["CMD-SHELL", "pg_isready -U postgres"]
# Set the interval to 10 seconds
interval: 10s
# Set the timeout to 5 seconds
timeout: 5s
# Set the retries to 5
retries: 5
volumes:
- todolistdb-data:/var/lib/postgresql/data
volumes:
todolistdb-data:
networks:
todolist-network: