-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
80 lines (75 loc) · 1.85 KB
/
Copy pathdocker-compose.yml
File metadata and controls
80 lines (75 loc) · 1.85 KB
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
version: '3'
services:
bot:
build: .
environment:
DATABASE: postgres://bot:bot@db/bot
depends_on:
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
db:
image: postgres:17.5-alpine3.22
environment:
POSTGRES_USER: bot
POSTGRES_DB: bot
# Insecure credentials are ok if the DB ports aren't exposed to the world.
POSTGRES_PASSWORD: bot
volumes:
# Make DB data persistent
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U bot -d bot"]
start_interval: 1s
start_period: 1m
interval: 10m
ports:
# Expose the DB port, but only to localhost, so that bot or sqitch running
# in dev environment (outside of docker) could connect.
- 127.0.0.1:5432:5432
# Before starting the bot, run schema migrations on the DB
migrations:
image: sqitch/sqitch:v1.5.2
volumes:
# The sqitch image starts with CWD in /repo
- ./migrations:/repo
depends_on:
db:
condition: service_healthy
command:
- "deploy"
- "-t"
- "db:pg://bot:bot@db/bot"
# Services used in tests:
test-db:
profiles:
- tests
image: postgres:17.5-alpine3.22
environment:
POSTGRES_USER: test
POSTGRES_DB: test
POSTGRES_PASSWORD: test
volumes: [] # Do not persist DB data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test -d test"]
start_interval: 1s
start_period: 1m
interval: 10m
ports:
- 127.0.0.1:54321:5432
test-migrations:
profiles:
- tests
image: sqitch/sqitch:v1.5.2
volumes:
- ./migrations:/repo
depends_on:
test-db:
condition: service_healthy
command:
- "deploy"
- "-t"
- "db:pg://test:test@test-db/test"
volumes:
db: