Spaces:
Sleeping
Sleeping
File size: 1,149 Bytes
36501d4 501847e 36501d4 501847e 36501d4 501847e f05c22e 36501d4 501847e 36501d4 501847e f05c22e 36501d4 501847e | 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 31 32 33 34 35 36 37 38 39 40 41 42 43 | # Hugging Face Spaces (Docker)
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/cache/hf \
TORCH_HOME=/cache/torch \
PORT=7860 \
RUNNING_GUNICORN=1 \
ALLOW_PROXY_FALLBACK=0
# System deps for soundfile & Kokoro
RUN apt-get update && apt-get install -y --no-install-recommends \
espeak-ng ffmpeg libsndfile1 git build-essential \
&& rm -rf /var/lib/apt/lists/*
# Create unprivileged user and caches
RUN useradd -m -u 1000 appuser && \
mkdir -p /app /cache/hf /cache/torch && \
chown -R appuser:appuser /app /cache
WORKDIR /app
# Install Python deps first (layer cache)
COPY --chown=appuser:appuser requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
# Install spaCy English model now (prevents runtime download)
RUN python -m spacy download en_core_web_sm
# Copy the app code
COPY --chown=appuser:appuser . .
# Pre-create static folders with correct ownership/permissions
RUN mkdir -p /app/static/audio /app/static/summaries && \
chmod -R 775 /app/static
USER appuser
EXPOSE 7860
CMD ["python", "app.py"]
|