-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
34 lines (33 loc) · 965 Bytes
/
Copy pathdocker-compose.yml
File metadata and controls
34 lines (33 loc) · 965 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
version: "3.9"
services:
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: awesome
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
retries: 5
migrate-up:
image: migrate/migrate:latest
entrypoint: [
"sh", "-c",
"while ! nc -z db 5432; do echo waiting for db; sleep 2; done; migrate -path /migrations -database postgres://postgres:postgres@db:5432/awesome?sslmode=disable up"
]
volumes:
- ./internal/db/migrations:/migrations
depends_on:
- db
migrate-down:
image: migrate/migrate:latest
entrypoint: [
"sh", "-c",
"while ! nc -z db 5432; do echo waiting for db; sleep 2; done; migrate -path /migrations -database postgres://postgres:postgres@db:5432/awesome?sslmode=disable down 1"
]
volumes:
- ./internal/db/migrations:/migrations
depends_on:
- db