Spaces:
Build error
Build error
| # Use a standard Python slim image for a lightweight CPU environment | |
| FROM python:3.11-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # --- Installation --- | |
| COPY requirements_local.txt . | |
| COPY download_models.py . | |
| RUN pip install --no-cache-dir -r requirements_local.txt | |
| # --- Pre-download and Cache Models --- | |
| # The RUN command securely accesses the HF_TOKEN secret to download all models. | |
| RUN --mount=type=cache,target=/root/.cache/huggingface \ | |
| --mount=type=secret,id=HUGGING_FACE_HUB_TOKEN \ | |
| HUGGING_FACE_HUB_TOKEN=$(cat /run/secrets/HUGGING_FACE_HUB_TOKEN) python download_models.py | |
| # --- Copy Application Files --- | |
| # We only need to copy the main application file now. | |
| COPY app.py . | |
| # Expose the port the app runs on | |
| EXPOSE 8000 | |
| # Command to run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] | |