-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yaml
47 lines (43 loc) · 915 Bytes
/
compose.yaml
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
services:
api:
build: .
ports:
- 8080:8080
env_file:
- .env
depends_on:
database:
condition: service_healthy
restart: true
networks:
- api_database
database:
image: postgres:16.3-alpine
restart: always
ports:
- ${DB_PORT}:${DB_PORT}
expose:
- ${DB_PORT}
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD_FILE: /run/secrets/database_password
PGPORT: ${DB_PORT}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
retries: 10
interval: 5s
timeout: 10s
volumes:
- database_data:/var/lib/postgresql/data
networks:
- api_database
secrets:
- database_password
volumes:
database_data:
networks:
api_database:
secrets:
database_password:
environment: DB_PASSWORD