# Use a stable slim Python base FROM python:3.11-slim # Prevent Python from writing .pyc files and enable unbuffered stdout/stderr ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Ensure /tmp is present and writable (Hugging Face uses /tmp) ENV TMPDIR=/tmp RUN mkdir -p /tmp && chmod 1777 /tmp # Create app directory WORKDIR /app # Copy project files COPY . /app # Install system dependencies required for pandas/openpyxl build RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential libpq-dev gcc g++ \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies # If your pipeline requires google-genai, include it; otherwise adjust as needed. RUN pip install --no-cache-dir -r requirements.txt # Create a non-root user (optional but recommended) RUN useradd -m appuser || true USER appuser # Expose port EXPOSE 7860 # Command to run the app CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]