# Use Python 3.11 slim image
FROM python:3.11-slim

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

# Set work directory
WORKDIR /app

# Install dependencies
COPY requirements.txt /app/
RUN pip install --upgrade pip && \
    pip install -r requirements.txt

# Copy project
COPY . /app/

# Startup script
RUN chmod +x /app/entrypoint.sh

# Expose port 8000
EXPOSE 8000

# Run the application with gunicorn (production-grade WSGI server)
CMD ["/app/entrypoint.sh"]
