-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
75 lines (70 loc) · 1.74 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
##############
# Docker Compose File
# Maintainer: Eri Adeodu (@50-Course)
# License: MIT License.
#
# Reference links:
# incase you feeling adventerous,
# - https://docs.docker.com/compose/compose-file/
# - https://nickjanetakis.com/blog/best-practices-around-production-ready-web-apps-with-docker-compose
# - https://https://hackmamba.io/blog/2022/09/best-practices-when-using-docker-compose/
##############
x-app: &base-app
build:
context: .
args:
- "UID=${UID:-1000}"
- "GID=${GID:-1000}"
env_file:
- ".env"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
tty: true
volumes:
- "${DOCKER_MOUNTED_VOLUME:-./public_sda:/app/public_sda}"
services:
backend:
<<: *base-app
container_name: backend-app
command: >
sh -c "
python /app/manage.py makemigrations api &&
python /app/manage.py makemigrations &&
python /app/manage.py migrate &&
python /app/manage.py collectstatic &&
python /app/manage.py runserver 0.0.0.0:8000
"
healthcheck:
test: curl http://0.0.0.0:8000/ || exit 1
interval: 1m30s
timeout: 40s
retries: 3
start_period: 30s
depends_on:
- db
- redis
ports:
- "8000:8000"
db:
image: postgres:14.5-bullseye
container_name: main_db
deploy:
resources:
limits:
cpus: "${DOCKER_MAX_ALLOWED_CPUS:-0}"
memory: "${DOCKER_MAX_ALLOWED_MEMORY:-0}"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
ports:
- 5432
volumes:
- "db:/var/lib/postgresql/data"
celery:
build:
context: .
command: celery -A core worker -B -l info
depends_on:
- backend
- redis
redis:
image: redis:6-alpine
volumes:
db: {}