-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
111 lines (105 loc) · 2.73 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
version: "3.8"
services:
mongodb:
image: djongo-blog/mongodb:7.0.2-ubi8
restart: always
build:
context: .
dockerfile: ./dockers/mongodb/Dockerfile
ports:
- 27017:27017
networks:
- backend
dev:
image: djongo-blog/project:latest-dev
working_dir: /home/project
command: >
bash -c "
python3 ./manage.py makemigrations --no-input &&
python3 ./manage.py migrate --no-input &&
python3 ./manage.py collectstatic --no-input &&
python3 ./manage.py setsuperuser --no-input --username ${DJANGO_SUPERUSER_USERNAME} --password ${DJANGO_SUPERUSER_PASSWORD} &&
gunicorn --workers 1 --threads 1 --reload --log-level debug -b ${DJANGO_IP}:${DJANGO_PORT} ${GUNICORN_APPLICATION}
"
build:
target: development
context: .
dockerfile: ./dockers/project/Dockerfile
expose:
- "${DJANGO_PORT}"
volumes:
- ./project:/home/project
env_file:
- ./envs/development.env
depends_on:
- mongodb
logging:
driver: "json-file"
options:
max-file: "1"
max-size: "32m"
networks:
- frontend
- backend
prod:
image: djongo-blog/project:latest-prod
restart: always
working_dir: /production/project
command: >
bash -c "
python3 ./manage.py makemigrations --no-input &&
python3 ./manage.py migrate --no-input &&
python3 ./manage.py collectstatic --no-input &&
python3 ./manage.py setsuperuser --no-input --username ${DJANGO_SUPERUSER_USERNAME} --password ${DJANGO_SUPERUSER_PASSWORD} &&
gunicorn --workers 4 --threads 4 -b ${DJANGO_IP}:${DJANGO_PORT} ${GUNICORN_APPLICATION}
"
build:
target: production
context: .
dockerfile: ./dockers/project/Dockerfile
expose:
- "${DJANGO_PORT}"
env_file:
- ./envs/production.env
depends_on:
- mongodb
logging:
driver: "json-file"
options:
max-file: "1"
max-size: "32m"
networks:
- frontend
- backend
nginx-dev:
image: djongo-blog/nginx:1.25-dev
build:
target: development
context: .
dockerfile: ./dockers/nginx/Dockerfile
ports:
- "${NGINX_PORT}:80"
volumes:
- ./project/static:/srv/www/project/static
- ./project/media:/srv/www/project/media
- ./project/logs:/srv/www/project/logs
depends_on:
- dev
networks:
- frontend
nginx-prod:
image: djongo-blog/nginx:1.25-prod
restart: always
build:
target: production
context: .
dockerfile: ./dockers/nginx/Dockerfile
ports:
- "${NGINX_PORT}:80"
depends_on:
- prod
networks:
- frontend
networks:
frontend:
backend: