# Use an official Python runtime as a base image
FROM python:3.12-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    gettext \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt

# Copy project files
COPY . .

# Collect static files (optional: if you use WhiteNoise or serve them)
RUN python manage.py collectstatic --noinput

# Expose the port the app runs on
EXPOSE 8000

# Default command
CMD ["gunicorn", "projectesm.wsgi:application", "--bind", "0.0.0.0:8000"]
