Fakultas Ilmu Komputer UI

Commit 3cb5b2f0 authored by hashlash's avatar hashlash
Browse files

[CHORES] add nginx to serve static files

parent 0a3b8c7e
version: '3.7'
services:
nginx:
image: nginx:stable
restart: always
ports:
- ${BACKEND_PORT:-8000}:80
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- staticfiles:/var/www/html/static/
depends_on:
- backend
backend:
build:
context: ./
......@@ -8,8 +18,7 @@ services:
command: gunicorn sizakat.wsgi --bind 0.0.0.0:8000 --log-file -
volumes:
- ./:/app/backend/
ports:
- ${BACKEND_PORT:-8000}:8000
- staticfiles:/app/backend/staticfiles/
env_file:
- .env
depends_on:
......@@ -24,3 +33,4 @@ services:
volumes:
postgres_data:
staticfiles:
......@@ -11,6 +11,7 @@ then
echo "PostgreSQL started"
fi
python manage.py collectstatic --no-input
python manage.py migrate
exec "$@"
server {
listen 80;
location /static/ {
root /var/www/html/;
}
location / {
proxy_pass http://backend:8000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment