Spaces:
Runtime error
Runtime error
File size: 977 Bytes
3dcee3c ae11e18 3dcee3c 5339a09 3dcee3c | 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 | FROM python:3.10-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# Install minimal build tools (some packages require compilation)
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
build-essential \
gcc \
ca-certificates \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
&& rm -rf /var/lib/apt/lists/*
# Install Python deps (cache layer)
COPY requirements.txt .
RUN pip install --upgrade pip setuptools wheel && pip install -r requirements.txt
# Create a non-root user and set ownership
RUN useradd -m appuser && mkdir -p /app
USER appuser
# Copy application code
COPY --chown=appuser:appuser . .
# Hugging Face Spaces expects the web process to listen on the provided PORT (defaults to 7860)
EXPOSE 7860
# Use PORT env if set by Spaces, default to 7860; include proxy headers for correct client IPs
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860} --proxy-headers"]
|