FROM python:3.11-slim # Create a non-root user for security (required by Hugging Face) RUN useradd -m -u 1000 user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 \ HF_HOME=/home/user/.cache/huggingface WORKDIR /home/user/app # Install dependencies first (better for caching) COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY --chown=user . . # Hugging Face Spaces specific port EXPOSE 7860 # ── CHANGE THIS LINE ────────────────────────────────────────────────────────── # Instead of running uvicorn directly, we run main.py which starts # both the FastAPI server and the Telegram Bot. CMD ["python", "main.py"] # ──────────────────────────────────────────────────────────────────────────────