- Implemented user authentication with JWT tokens - Added user and profile models with OneToOne relationship - Created service layer for business logic separation - Implemented DRF serializers and views - Added comprehensive test suite with model-bakery factories - Fixed ipdb/pdbpp dependency conflicts with custom test runner - Configured development and production environments - Added deployment configurations for Apache, systemd, and Docker
41 lines
1.2 KiB
Docker
41 lines
1.2 KiB
Docker
FROM python:3.11.2-slim
|
|
|
|
# Установка системных зависимостей
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
postgresql-client \
|
|
libpq-dev \
|
|
libffi-dev \
|
|
libxml2-dev \
|
|
libxslt1-dev \
|
|
zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Создание рабочей директории
|
|
WORKDIR /app
|
|
|
|
# Копирование файлов зависимостей
|
|
COPY requirements.txt .
|
|
COPY requirements-dev.txt .
|
|
|
|
# Установка Python зависимостей
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
RUN pip install --no-cache-dir -r requirements-dev.txt
|
|
|
|
# Копирование исходного кода
|
|
COPY src/ ./src/
|
|
|
|
# Создание необходимых директорий
|
|
RUN mkdir -p logs staticfiles media
|
|
|
|
# Создание пользователя для запуска приложения
|
|
RUN groupadd -r appgroup && useradd -r -g appgroup appuser
|
|
RUN chown -R appuser:appgroup /app
|
|
USER appuser
|
|
|
|
# Открытие порта
|
|
EXPOSE 8000
|
|
|
|
# Команда по умолчанию
|
|
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"] |