2025-11-23 19:12:27 +00:00
|
|
|
FROM python:3.12-slim
|
2025-11-22 19:13:34 +00:00
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# Environment settings
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
2025-11-22 19:13:34 +00:00
|
|
|
|
|
|
|
|
# Set work directory
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# System dependencies
|
2025-11-22 19:13:34 +00:00
|
|
|
RUN apt-get update && apt-get install -y \
|
2025-11-23 18:36:23 +00:00
|
|
|
build-essential \
|
|
|
|
|
curl wget \
|
2025-11-22 19:13:34 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# Copy dependency file
|
|
|
|
|
COPY requirements.txt .
|
2025-11-22 19:13:34 +00:00
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# Install Python dependencies
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
2025-11-23 18:36:23 +00:00
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# Copy project files
|
2025-11-22 19:13:34 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# Expose port
|
2025-11-23 18:26:44 +00:00
|
|
|
EXPOSE 8000
|
2025-11-22 19:13:34 +00:00
|
|
|
|
2025-11-23 19:12:27 +00:00
|
|
|
# Run migrations + collectstatic + gunicorn at runtime
|
|
|
|
|
CMD \
|
|
|
|
|
python manage.py migrate && \
|
|
|
|
|
python manage.py collectstatic --noinput && \
|
2025-11-23 19:19:29 +00:00
|
|
|
python manage.py runserver 0.0.0.0:8000 && \
|
|
|
|
|
# gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3
|