-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
65 lines (65 loc) · 2.49 KB
/
docker-compose.prod.yml
File metadata and controls
65 lines (65 loc) · 2.49 KB
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
services:
change-vol-ownership:
# We can use any image we want as long as we can chown
image: ubuntu
# Need a user priviliged enough to chown
user: "root"
# Specify the group in question
group_add:
- '1000'
volumes:
# The volume to chown
- static-data:/tmp/change-ownership
command: chown -R 1000:1000 /tmp/change-ownership
webcentral:
build:
context: ${PWD}/webcentral
dockerfile: Dockerfile
target: prod
args:
WEBCENTRAL_UNPRIVILEGED_USER: ${WEBCENTRAL_UNPRIVILEGED_USER}
volumes:
- static-data:/home/${WEBCENTRAL_UNPRIVILEGED_USER}/webcentral
depends_on:
- change-vol-ownership
restart: always
env_file:
- .env
environment:
- UWSGI_LISTEN_PORT
- UWSGI_NUM_WORKERS
- SECRET_KEY
- DEBUG
- ALLOWED_HOSTS
- MODE=production
command: >
bash -c "python /home/$WEBCENTRAL_UNPRIVILEGED_USER/src/manage.py collectstatic --noinput && \
uwsgi --socket :$UWSGI_LISTEN_PORT --chdir=/home/$WEBCENTRAL_UNPRIVILEGED_USER/src --master --processes 4 --threads 2 --module=webcentral_app.wsgi:application --uid $WEBCENTRAL_UNPRIVILEGED_USER --gid $WEBCENTRAL_UNPRIVILEGED_USER"
proxy:
container_name: proxy
build:
context: ./proxy
restart: always
depends_on:
- webcentral
ports:
# - ${PORT_TO_OUTSIDE}:${NGINX_LISTEN_PORT}
- 443:${NGINX_LISTEN_PORT}
# data communication on port 80 on the host
# gets mapped to port 8000 inside the proxy container
environment:
- NGINX_LISTEN_PORT
- UWSGI_LISTEN_PORT
- NGINX_SSL_CERTIFICATE_FILENAME
- NGINX_SSL_CERTIFICATE_KEY_FILENAME
volumes:
- static-data:/vol/static
- ./proxy/dhparam/:/etc/nginx/dhparam
# - ./proxy/conf/:/etc/nginx/ssl/
# the proxy can directly serve the static data, without bothering
# the django app
command: >
bash -c "if [[ "$USE_PROD_LOCALLY" == "0" ]]; then envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf; else envsubst < /etc/nginx/localDefault.conf.tpl > /etc/nginx/conf.d/default.conf; fi && \
nginx -g 'daemon off;'"
volumes:
static-data: