lab-2: add dockerfile for backend and nginx

This commit is contained in:
DeevEV 2026-04-25 10:05:00 +03:00
parent 6634e796aa
commit fba9c7d5a4
3 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,11 @@
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .

View file

@ -0,0 +1,3 @@
FROM nginx:latest
COPY templates /etc/nginx/templates/

View file

@ -0,0 +1,27 @@
server {
listen 80;
resolver 127.0.0.11 valid=30s;
location /static/ {
alias /staticfiles/;
}
location /admin/ {
set $backend backend_service;
proxy_pass http://$backend:8000$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
location /api/ {
set $backend backend_service;
proxy_pass http://$backend:8000$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
}