-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
85 lines (81 loc) · 2.08 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
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
services:
app:
container_name: api
env_file: .env
build:
context: .
target: dev
dockerfile: Dockerfile
ports:
- '3000:${PORT}'
expose:
- '3000'
tty: true
volumes:
- ./:/app
links:
- database
depends_on:
database:
condition: service_healthy
networks:
- appnetwork
restart: always
database:
image: 'postgres:17.2-bookworm'
container_name: db
env_file: '.env'
environment:
POSTGRES_PASSWORD: ${DB_ROOT_PASSWORD}
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
ports:
- 5432:5432
expose:
- '5432'
volumes:
- 'db_data:/var/lib/postgresql/data'
restart: on-failure
healthcheck:
test:
[
'CMD',
'pg_isready',
'-q',
'-d',
'${DB_NAME}',
'-U',
'${DB_USER}',
]
interval: 5s
timeout: 3s
retries: 3
networks:
- appnetwork
# postgres migration tool
goose:
container_name: goose-runner
profiles: ['tools']
env_file: .env
build:
context: .
target: goose
dockerfile: Dockerfile
environment:
GOOSE_DRIVER: postgres
GOOSE_DBSTRING: postgres://${DB_USER}:${DB_ROOT_PASSWORD}@db:5432/${DB_NAME}?sslmode=disable
GOOSE_MIGRATION_DIR: /migrations
volumes:
- ./db/migrations:/migrations
# https://github.com/pressly/goose?tab=readme-ov-file#usage
entrypoint: ['goose', '-s', '-timeout', '5m']
networks:
- appnetwork
depends_on:
database:
condition: service_healthy
restart: never
volumes:
db_data:
networks:
appnetwork: