From 4df043d73068ba0116851794898bd8d332069b7d Mon Sep 17 00:00:00 2001 From: chapeau Date: Wed, 24 Apr 2024 15:16:40 +0200 Subject: [PATCH] Fix static issues when no CDN is used --- docker-compose.yml | 4 +++- docker/Dockerfile-nginx | 2 +- docker/Dockerfile-re2o | 2 +- docker/nginx.conf | 16 ++++++++++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8abc943d..6fb6f386 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: depends_on: - db volumes: - - ./re2o/settings_local.py:./re2o/settings_local.py:ro + - ./re2o/settings_local.py:/code/re2o/settings_local.py:ro environment: - POSTGRES_DB=postgres - POSTGRES_USER=postgres @@ -37,5 +37,7 @@ services: dockerfile: ./docker/Dockerfile-nginx volumes: - ./media:/media + depends_on: + - re2o ports: - "80:80" \ No newline at end of file diff --git a/docker/Dockerfile-nginx b/docker/Dockerfile-nginx index 3b76657d..5a6268dc 100644 --- a/docker/Dockerfile-nginx +++ b/docker/Dockerfile-nginx @@ -2,7 +2,7 @@ FROM python:3.9-bullseye AS build ENV PYTHONUNBUFFERED=1 RUN pip install poetry WORKDIR /code -RUN apt-get update && apt-get install -y --no-install-recommends gettext-base gettext libpq-dev +RUN apt-get update && apt-get install -y --no-install-recommends gettext-base gettext libpq-dev fonts-font-awesome libjs-bootstrap libjs-jquery COPY . /code/ RUN poetry install --extras "postgresql" ENV POSTGRES_DB=postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres SUPERUSER_LOGIN=admin SUPERUSER_PASS=admin SUPERUSER_EMAIL=admin@example.net ENV=dev diff --git a/docker/Dockerfile-re2o b/docker/Dockerfile-re2o index 55e3dd6e..473172c4 100644 --- a/docker/Dockerfile-re2o +++ b/docker/Dockerfile-re2o @@ -2,7 +2,7 @@ FROM python:3.9-bullseye AS base ENV PYTHONUNBUFFERED=1 RUN pip install poetry WORKDIR /code -RUN apt-get update && apt-get install -y --no-install-recommends gettext-base gettext libpq-dev graphviz +RUN apt-get update && apt-get install -y --no-install-recommends gettext-base gettext libpq-dev graphviz fonts-font-awesome libjs-bootstrap libjs-jquery COPY . /code/ CMD ./docker/docker-entrypoint.sh diff --git a/docker/nginx.conf b/docker/nginx.conf index cf36d899..d6b1cc3a 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -7,12 +7,20 @@ server { keepalive_timeout 5; - location /static { - alias /static; + location /static/ { + alias /static/; + } + + location /javascript/bootstrap/ { + alias /static/; + } + + location /javascript/jquery/ { + alias /static/admin/js/vendor/jquery/; } location /media/ { - alias /media; + alias /media/; } location / { @@ -20,7 +28,7 @@ server { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_redirect off; - proxy_pass http://re2o:8000; + proxy_pass http://re2o:8000$request_uri; } error_page 500 502 503 504 /50x.html;