-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
91 lines (81 loc) · 2.16 KB
/
docker-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
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
86
87
88
89
90
91
version: '3.5'
services:
db:
container_name: db
image: postgres:14.1-alpine
environment: &db_env
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
PGDATA: /data/postgres
ports:
- "5432:5432"
restart: unless-stopped
volumes:
- db-volume:/var/lib/postgresql/data
# NOTE: Test DB doesn't require a persistent volume, since the data isn't supposed and should'nt be persisted
test-db:
container_name: test-db
image: postgres:14.1-alpine
environment:
<<: *db_env
ports:
- "15432:5432"
pipeline: &pipeline
container_name: pipeline
build: ./pipeline
# command: tail -F anything
depends_on:
db:
condition: service_started
environment: &db_environment
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
DB_NAME: ${POSTGRES_DB_NAME:-postgres}
api: &api
container_name: api
build: ./api
# command: tail -F anything
depends_on:
db:
condition: service_started
ports:
- "8000:8000"
environment:
<<: *db_environment
api-tests-base: &api-tests-base
<<: *api
build: ./api
environment: &db_test_environment
POSTGRES_HOST: ${POSTGRES_HOST:-test-db}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
DB_NAME: ${POSTGRES_DB_NAME:-postgres}
depends_on:
test-db:
condition: service_started
links:
- test-db:test-db
container_name: api_tests
command: pytest -v
api-tests-local:
<<: *api-tests-base
volumes:
- ./api:/usr/src/app/
api-tests-ci:
container_name: api-tests-ci
build: ./api
environment:
POSTGRES_HOST: ${POSTGRES_HOST:-db}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
DB_NAME: ${POSTGRES_DB_NAME:-postgres}
depends_on:
db:
condition: service_started
command: pytest -v
volumes:
db-volume:
external: true