sky / Dockerfile
triflix's picture
Update Dockerfile
4ecc196 verified
raw
history blame contribute delete
832 Bytes
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"]