-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
79 lines (75 loc) · 1.84 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
volumes:
postgresql-data:
services:
app_database:
image: postgres:16
restart: always
expose:
- "5432"
ports:
- "5432:5432"
volumes:
- postgresql-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: app
POSTGRES_DB: app_db
POSTGRES_PASSWORD: app_pw
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 2s
timeout: 5s
retries: 10
test_database:
image: postgres:16
restart: always
expose:
- "5432"
environment:
POSTGRES_USER: test
POSTGRES_DB: test_db
POSTGRES_PASSWORD: test_pw
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 2s
timeout: 5s
retries: 10
tests:
build:
context: .
dockerfile: app.Dockerfile
target: tests
command: ./test_entrypoint.sh
environment:
DATABASE_URL: postgresql+psycopg://test:test_pw@test_database:5432/test_db
volumes:
- ./alembic.ini:/app/alembic.ini
- ./migrations:/app/migrations
- ./pyproject.toml:/app/pyproject.toml
- ./src:/app/src
- ./test_entrypoint.sh:/app/test_entrypoint.sh
- ./tests:/app/tests
depends_on:
test_database:
condition: service_healthy
web:
container_name: matamata
build:
context: .
dockerfile: app.Dockerfile
target: web
command: ./app_entrypoint.sh
environment:
DATABASE_URL: postgresql+psycopg://app:app_pw@app_database:5432/app_db
volumes:
- ./alembic.ini:/app/alembic.ini
- ./app_entrypoint.sh:/app/app_entrypoint.sh
- ./migrations:/app/migrations
- ./pyproject.toml:/app/pyproject.toml
- ./src:/app/src
ports:
- "8000:8000"
depends_on:
app_database:
condition: service_healthy
tests:
condition: service_completed_successfully