Skip to content
Snippets Groups Projects
Verified Commit 37e9987b authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

[Docker] Server static files via nginx

parent 5634007d
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ services:
image: registry.edugit.org/aleksis/official/aleksis:${ALEKSIS_IMAGE_TAG:-latest}
volumes:
- aleksis_data:/var/lib/aleksis/
- aleksis_static:/usr/share/aleksis/static/
environment:
- ALEKSIS_http__allowed_hosts="['*']"
- ALEKSIS_caching__memcached__address=memcached:11211
......@@ -28,6 +29,7 @@ services:
image: registry.edugit.org/aleksis/official/aleksis/nginx:${ALEKSIS_IMAGE_TAG:-latest}
volumes:
- aleksis_data:/var/lib/aleksis/
- aleksis_static:/usr/share/aleksis/static/:ro
ports:
- ${NGINX_HTTP_PORT:-8080}:80
depends_on:
......
......@@ -17,6 +17,7 @@ while ! nc -z $ALEKSIS_database__host $ALEKSIS_database__port; do
sleep 0.1
done
python manage.py collectstatic --no-input --clear
python manage.py migrate
if [[ -n "$@" ]]; then
......
......@@ -5,6 +5,14 @@ upstream aleksis {
server {
listen 80;
location /media/ {
alias /var/lib/aleksis/media/;
}
location /static/ {
alias /usr/share/aleksis/static/;
}
location / {
proxy_pass http://aleksis;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......@@ -12,7 +20,4 @@ server {
proxy_redirect off;
}
location /media/ {
alias /var/lib/aleksis/media/;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment