-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
58 lines (54 loc) · 1.26 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
version: "3.8"
services:
# Creates a db to serve the api
postgres:
container_name: postgres
restart: always
image: postgres
environment:
- POSTGRES_USER=testusr
- POSTGRES_PASSWORD=password
- POSTGRES_HOST=postgres
- POSTGRES_DB=testdb
volumes:
- flask-app-db:/var/lib/postgresql/data
ports:
- 5432:5432
# Creates a db for unit testing
postgrestest:
container_name: postgrestest
restart: always
image: postgres
environment:
- POSTGRES_USER=unittest
- POSTGRES_PASSWORD=password
- POSTGRES_HOST=postgrestest
- POSTGRES_DB=testdb
volumes:
- flask-test-db:/var/lib/postgresql/data
ports:
- 5433:5432
# Creates the api
app:
container_name: app
restart: always
build:
context: .
dockerfile: Dockerfile
environment:
- FLASK_ENV=development
- DATABASE_URL=postgresql://testusr:password@postgres:5432/testdb
- UNITTEST_DB=postgresql://unittest:password@postgrestest:5432/testdb
ports:
- 5000:5000
volumes:
- .:/app
depends_on:
- postgres
- postgrestest
entrypoint: ["python3", "run.py"]
volumes:
flask-test-db:
name: flask-test-db
flask-app-db:
name: flask-app-db