hedrekao
update docker
8e755a1
# Dockerfile for Hugging Face Spaces deployment
# Uses uv for fast dependency management
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies
# - libsndfile1: Required by soundfile for audio I/O
# - ffmpeg: Required by whisper for audio processing
# - git: Required for some pip installs
# - build-essential: Required to compile wheels like webrtcvad
# - curl: Required by HEALTHCHECK
RUN apt-get update && apt-get install -y \
libsndfile1 \
ffmpeg \
git \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Copy project files
COPY pipeline_modules/ ./pipeline_modules/
COPY approaches/ ./approaches/
COPY pyproject.toml uv.lock* ./
COPY README.md ./
COPY main.py app.py ./
# Create data directory (optional, for example files)
RUN mkdir -p data output
# Install dependencies with uv
# --system: Install to system Python instead of creating a venv
# --no-dev: Skip dev dependencies
RUN uv sync --frozen --no-dev --extra asr
# Expose Streamlit port (HF Spaces uses 7860)
EXPOSE 7860
# Health check
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
# Run Streamlit
# --server.port=7860: HF Spaces default port
# --server.address=0.0.0.0: Listen on all interfaces
# --server.headless=true: Run in headless mode
# --browser.gatherUsageStats=false: Disable telemetry
CMD ["uv", "run", "streamlit", "run", "app.py", \
"--server.port=7860", \
"--server.address=0.0.0.0", \
"--server.headless=true", \
"--server.enableCORS=false", \
"--server.enableXsrfProtection=false", \
"--browser.gatherUsageStats=false"]