generated from bisco/codex-bootstrap
fix(docker): serve django static files via nginx
This commit is contained in:
@@ -19,11 +19,14 @@ services:
|
||||
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
|
||||
expose:
|
||||
- "${BACKEND_PORT:-8000}"
|
||||
volumes:
|
||||
- django_static:/app/staticfiles
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- internal
|
||||
user: "0:0"
|
||||
restart: unless-stopped
|
||||
|
||||
frontend:
|
||||
@@ -66,6 +69,7 @@ services:
|
||||
NGINX_ENVSUBST_FILTER: "^(BACKEND_HOST|BACKEND_PORT|FRONTEND_HOST|FRONTEND_PORT)$"
|
||||
volumes:
|
||||
- ./nginx/templates:/etc/nginx/templates:ro
|
||||
- django_static:/var/www/static:ro
|
||||
depends_on:
|
||||
- backend
|
||||
- frontend
|
||||
@@ -75,6 +79,7 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
django_static:
|
||||
|
||||
networks:
|
||||
internal:
|
||||
|
||||
@@ -29,9 +29,9 @@ server {
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
proxy_pass http://azionelab_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
alias /var/www/static/;
|
||||
access_log off;
|
||||
expires 1d;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
|
||||
Reference in New Issue
Block a user