Merge branch '10884-dockerify' of code.ungleich.ch:ungleich-public/gmba_django into 10884-dockerify

This commit is contained in:
app 2022-09-20 04:21:57 +00:00
commit a80158da66
3 changed files with 13 additions and 1 deletions

View file

@ -45,6 +45,7 @@ ENV HOME=/home/app
ENV APP_HOME=/home/app/app ENV APP_HOME=/home/app/app
RUN mkdir $APP_HOME RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static RUN mkdir $APP_HOME/static
RUN mkdir $APP_HOME/media
WORKDIR $APP_HOME WORKDIR $APP_HOME
# install dependencies # install dependencies

View file

@ -8,6 +8,7 @@ services:
command: gunicorn gmba_django.wsgi:application --bind 0.0.0.0:8000 command: gunicorn gmba_django.wsgi:application --bind 0.0.0.0:8000
volumes: volumes:
- static_volume:/home/app/app/static - static_volume:/home/app/app/static
- media_volume:/home/app/app/media
expose: expose:
- 8000 - 8000
env_file: env_file:
@ -24,6 +25,7 @@ services:
build: ./nginx build: ./nginx
volumes: volumes:
- static_volume:/home/app/app/static - static_volume:/home/app/app/static
- media_volume:/home/app/app/media
ports: ports:
- 1337:80 - 1337:80
depends_on: depends_on:
@ -32,3 +34,4 @@ services:
volumes: volumes:
postgres_data: postgres_data:
static_volume: static_volume:
media_volume:

View file

@ -5,6 +5,8 @@ upstream gmba_django {
server { server {
listen 80; listen 80;
client_max_body_size 256m;
location / { location / {
proxy_pass http://gmba_django; proxy_pass http://gmba_django;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -12,9 +14,15 @@ server {
proxy_redirect off; proxy_redirect off;
} }
location /static/ { location /static/ {
alias /home/app/app/static/; alias /home/app/app/static/;
expires max;
} }
location /media/ {
alias /home/app/app/media/;
expires max;
}
add_header Content-Security-Policy "frame-ancestors https://www.gmba.unibe.ch"
} }