File size: 1,518 Bytes
72277b5
 
 
070d9af
72277b5
20abd1e
72277b5
20abd1e
 
 
72277b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20abd1e
72277b5
 
 
 
 
 
 
 
 
 
20abd1e
 
 
eb4ba32
72277b5
 
 
 
 
b67cb1c
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
# 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"]