# Use a lightweight Python image FROM python:3.11-slim WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy server code COPY server.py . # Set Environment defaults ENV PORT=7860 ENV API_KEY="replace_in_huggingface_settings" # Run as non-root user for security RUN useradd -m myuser USER myuser # Start FastAPI with Uvicorn CMD ["python", "server.py"]