-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
70 lines (65 loc) · 1.58 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
version: "3.8"
services:
server:
image: art3xa/fastapi-template:latest
container_name: app
build:
context: .
dockerfile: docker/server/Dockerfile
ports:
- "8000:8000"
logging:
driver: json-file
restart: on-failure
tests:
container_name: app-tests
build:
context: .
dockerfile: docker/tests/Dockerfile
restart: always
command: "sh -c 'poetry run alembic upgrade head && poetry run uvicorn src.app.main:app --reload --workers 3 --host 0.0.0.0 --port 8000'"
volumes:
- .:/opt/app
ports:
- "8000:8000"
depends_on:
database:
condition: service_healthy
logging:
driver: json-file
env_file:
- .env
environment:
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
autotests:
container_name: autotests
build:
context: .
dockerfile: docker/autotests/Dockerfile
database:
container_name: database
image: docker.io/bitnami/postgresql:latest
restart: always
user: root
volumes:
- './postgresql_data:/bitnami/postgresql'
ports:
- "5432:5432" # Remove this on production
expose:
- 5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${DATABASE_NAME} -U ${DATABASE_USERNAME}"]
interval: 10s
timeout: 5s
retries: 5
logging:
driver: json-file
env_file:
- .env
environment:
- POSTGRESQL_USERNAME=${DATABASE_USERNAME}
- POSTGRESQL_PASSWORD=${DATABASE_PASSWORD}
- POSTGRESQL_DATABASE=${DATABASE_NAME}
volumes:
postgresql_data: