# Base image with Python
FROM python:3.11-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt /app/

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt



# Install system dependencies
RUN apt-get update && apt-get install -y \
    gcc \
    libgomp1 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Copy the application code
COPY . /app/



# Expose the port
EXPOSE 780

ENV FLASK_APP app.py
ENV FLASK_RUN_HOST 0.0.0.0

# Start the application with gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]