FROM python:3.12-slim WORKDIR /app ENV PYTHONUNBUFFERED=1 # Build args and env vars... ARG HF_TOKEN HF_REPO_ID ENV HF_TOKEN=$HF_TOKEN HF_REPO_ID=$HF_REPO_ID # Copy & install dependencies COPY requirements.txt . RUN pip install --upgrade pip \ && pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir "huggingface_hub[cli]" # Copy application code BEFORE deploying COPY . . # Authenticate & deploy to Spaces RUN huggingface-cli login --token "$HF_TOKEN" \ && printf "\napp.py\n\nn\nn\n" | gradio deploy EXPOSE 7860 CMD ["python", "app.py"]