Spaces:
Build error
Build error
File size: 846 Bytes
9fca407 bd9f042 1ab6f41 9fca407 1425e56 9fca407 6401a84 1ab6f41 053c667 9fca407 053c667 9fca407 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 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"]
|