File size: 1,699 Bytes
a361db3 3e3ea00 a361db3 3e3ea00 a361db3 2da7e8e a361db3 3e3ea00 a361db3 2da7e8e a361db3 8e755a1 a361db3 | 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # 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"]
|