# Use a slim Python image for efficiency FROM python:3.10-slim # Install system dependencies needed for tgcrypto and network tools RUN apt-get update && apt-get install -y \ gcc \ python3-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Create a non-root user as required by Hugging Face Spaces RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app # Copy requirements first to leverage Docker cache COPY --chown=user requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the application code COPY --chown=user . /app # Hugging Face Spaces listen on port 7860 by default EXPOSE 7860 # Start the FastAPI app using uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]