diff --git a/docker-compose.yml b/docker-compose.yml index 7dfda92d115c70c30e77abf1f4bfdd29f1778440..9d4b114989a63b16172e4edb8145c38717e28f6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index bb5eca2a1b901797ef2cbaa7f4d4ff2670ef9811..bd6cc310bd05dbea6aaff274883f9cba985eaed2 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -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 diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index 49c1f9a7573fc5e5cf60c85dc6b5d87cc3744e2f..759f385041ce7bd7dc06b487ff2dfb2c43635482 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -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/; - } }