# =================================================================== # Development Dockerfile - Fast builds with development tools # =================================================================== FROM python:3.12-slim-bookworm # Install build and runtime dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ default-libmysqlclient-dev \ default-mysql-client \ pkg-config \ curl \ vim \ && rm -rf /var/lib/apt/lists/* # Create django user RUN useradd -m -u 1000 -s /bin/bash django # Set working directory WORKDIR /app # Install Python dependencies # Note: In dev mode, code is mounted as volume, so we just install deps COPY requirements.txt /tmp/ RUN pip install --no-cache-dir -r /tmp/requirements.txt \ && pip install --no-cache-dir mysqlclient gunicorn # Create directories RUN mkdir -p /app/media /app/staticfiles && \ chown -R django:django /app # Switch to django user USER django # Set Python to run in unbuffered mode ENV PYTHONUNBUFFERED=1 # Expose port 8000 EXPOSE 8000 # Entrypoint script handles service startup ENTRYPOINT ["/app/docker/entrypoint.sh"] # Default command for dev is Django runserver CMD ["runserver"]