forked from 2023-AlphaProject/iBelieveSurvey_backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.production.yml
64 lines (61 loc) · 1.67 KB
/
docker-compose.production.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
version: "3"
services:
nginx:
build:
context: ./nginx
dockerfile: ./Dockerfile
image: nginx
restart: always
ports:
- "80:80"
depends_on:
- django
links:
- django
entrypoint:
- /docker-entrypoint.sh
volumes:
- ./log:/var/log/nginx
- ./webapp/staticfiles:/static
- ./webapp/mediafiles:/media
django:
build:
context: ./webapp
dockerfile: ./Dockerfile.production
image: django
restart: always
command: >
bash -c "python ./manage.py makemigrations --noinput &&
python ./manage.py migrate --noinput &&
python ./manage.py template_objs_in_db &&
python ./manage.py collectstatic --noinput &&
service cron start && python manage.py crontab add &&
gunicorn config.wsgi:application --env DJANGO_SETTINGS_MODULE=config.settings.production --bind 0.0.0.0:8000"
volumes:
- ./webapp:/srv
- ./log:/var/log/
- ./webapp/staticfiles:/srv/static
- ./webapp/mediafiles:/srv/media
depends_on:
- db
db:
image: postgres
expose:
- ${POSTGRES_PORT}
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_INITDB_ARGS=--encoding=UTF-8
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_PORT=${POSTGRES_PORT}
volumes:
- ./db/initial_setup.sql:/docker-entrypoint-initdb.d/initial_setup.sql
- postgres_data:/var/lib/postgresql/data/
command: -p ${POSTGRES_PORT}
restart: always
volumes:
postgres_data:
staticfiles:
mediafiles: