File size: 832 Bytes
2061a01 4ecc196 2061a01 4ecc196 2061a01 4ecc196 2061a01 4ecc196 2061a01 4ecc196 |
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 29 30 |
FROM python:3.10-slim
# 1️⃣ Create writable cache directory for Hugging Face Hub
RUN mkdir -p /app/.cache/huggingface/hub && \
chown -R root:root /app/.cache/huggingface
# 2️⃣ Redirect HF cache environment variables
ENV HF_HOME=/app/.cache/huggingface \
HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface/hub \
TRANSFORMERS_CACHE=/app/.cache/huggingface
# 3️⃣ Install system dependencies
RUN apt-get update && \
apt-get install -y espeak-ng && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 4️⃣ Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# 5️⃣ Copy application code
COPY . .
# 6️⃣ Expose Spaces default port
EXPOSE 7860
# 7️⃣ Start the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |