# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # you will also find guides on how best to write your Dockerfile FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 # Install Python and system dependencies RUN apt-get update && apt-get install -y \ python3.10 \ python3.10-dev \ python3-pip \ build-essential \ git \ curl \ ffmpeg \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean # Set working directory WORKDIR /app # Create static directory and set permissions RUN mkdir -p /app/static && chmod 777 /app/static # Create a non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Copy requirements first to leverage Docker cache COPY --chown=user requirements.txt . RUN pip3 install --no-cache-dir --upgrade -r requirements.txt # Copy application files COPY --chown=user *.py /app/ COPY --chown=user whisper_streaming_custom /app/whisper_streaming_custom/ COPY --chown=user diarization /app/diarization/ COPY --chown=user static /app/static/ # Set environment variables ENV PYTHONPATH=/app ENV PYTHONUNBUFFERED=1 ENV CUDA_HOME=/usr/local/cuda ENV PATH=${CUDA_HOME}/bin:${PATH} ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} ENV CUDNN_PATH=/usr/lib/x86_64-linux-gnu/libcudnn.so # Expose the port the server runs on EXPOSE 7860 # Run the server using main.py CMD ["python3", "main.py", "--host", "0.0.0.0", "--port", "7860", "--model", "large-v3-turbo", "--backend", "faster-whisper", "--task", "transcribe"]