Site/dockerfile
2025-11-19 19:32:39 +03:00

33 lines
1010 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM python:3.11-slim
# Устанавливаем системные зависимости
RUN apt-get update && apt-get install -y \
gcc \
python3-dev \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Копируем весь проект
COPY . .
# ОБНОВЛЯЕМ PIP до последней версии
RUN pip install --upgrade pip
# Создаем базовый requirements.txt если его нет
RUN if [ ! -f requirements.txt ]; then \
echo "Django>=4.2,<5.0" > requirements.txt; \
echo "gunicorn==21.2.0" >> requirements.txt; \
echo "whitenoise==6.5.0" >> requirements.txt; \
echo "Pillow==10.0.0" >> requirements.txt; \
echo "psycopg2-binary==2.9.7" >> requirements.txt; \
echo "django-bootstrap5==23.3" >> requirements.txt; \
fi
# Устанавливаем зависимости
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]