Нужна помощь в загрузке статических файлов с nginx и django в контейнер
У меня проблемы с загрузкой статических файлов из моего проекта django.
Вот изображение моих директорий: direcctories
.
Я запустил docker-compose и получил следующие ошибки: ERRORS
.
Вот как выглядит мой файл nginx (default.conf):
default.conf
http {
server {
listen 8080;
access_log /var/log/nginx/access.log
location / {
root /frontend/templates/frontend
# proxy_pass http://pathfinder_gunicorn;
# include /etc/nginx/mime.types;
}
location /static/ {
alias /static/;
}
location ~ \.(css)$ {
root /frontend/static/css;
}
}
}
Вот мой Dockerfile:
FROM python:3.9-alpine
ENV PYTHONUNBUFFERED 1
WORKDIR /pathfinder
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
COPY ./entrypoint.sh /
ENTRYPOINT ["sh", "entrypoint.sh"]
RUN apk update
RUN apk add
RUN apk add npm
COPY ./frontend/package.json /frontend/package.json
COPY ./frontend/package-lock.json /frontend/package-lock.json
RUN cd frontend/ && npm install
RUN cd frontend/ && pwd
Вот мой docker-compose.yml:
version: "3.8"
services:
pathfinder_gunicorn:
build:
context: .
volumes:
- static:/static
- ./frontend/static/:/frontend/static/
ports:
- "8080:8080"
image: pathfinder_gunicorn:v1
container_name: pathfinder_gunicorn
nginx:
build: ./nginx
volumes:
- static:/static
ports:
- "80:80"
depends_on:
- pathfinder_gunicorn
volumes:
static:
Вот путь к директории из моего docker-compose и Dockerfile:
./frontend/static/css. Директория выглядит следующим образом: DIRECTORY