33 lines
1010 B
Plaintext
33 lines
1010 B
Plaintext
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"] |