cagram commited on
Commit
730b419
·
1 Parent(s): d5d08e2

Add Dockerfile w/ GPU support.

Browse files
Files changed (1) hide show
  1. Dockerfile +82 -0
Dockerfile ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PYTHONUNBUFFERED=1
5
+
6
+ WORKDIR /app
7
+
8
+ ARG EXTRAS
9
+ ARG HF_PRECACHE_DIR
10
+ ARG HF_TKN_FILE
11
+
12
+ # Install system dependencies
13
+ #RUN apt-get update && \
14
+ # apt-get install -y ffmpeg git && \
15
+ # apt-get clean && \
16
+ # rm -rf /var/lib/apt/lists/*
17
+
18
+ # 2) Install system dependencies + Python + pip
19
+ RUN apt-get update && \
20
+ apt-get install -y --no-install-recommends \
21
+ python3 \
22
+ python3-pip \
23
+ ffmpeg \
24
+ git && \
25
+ rm -rf /var/lib/apt/lists/*
26
+
27
+ RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
28
+
29
+ COPY . .
30
+
31
+ # Install WhisperLiveKit directly, allowing for optional dependencies
32
+ # Note: For gates modedls, need to add your HF toke. See README.md
33
+ # for more details.
34
+ RUN if [ -n "$EXTRAS" ]; then \
35
+ echo "Installing with extras: [$EXTRAS]"; \
36
+ pip install --no-cache-dir .[$EXTRAS]; \
37
+ else \
38
+ echo "Installing base package only"; \
39
+ pip install --no-cache-dir .; \
40
+ fi
41
+
42
+ # Enable in-container caching for Hugging Face models by:
43
+ # Note: If running multiple containers, better to map a shared
44
+ # bucket.
45
+ #
46
+ # A) Make the cache directory persistent via an anonymous volume.
47
+ # Note: This only persists for a single, named container. This is
48
+ # only for convenience at de/test stage.
49
+ # For prod, it is better to use a named volume via host mount/k8s.
50
+ VOLUME ["/root/.cache/huggingface/hub"]
51
+
52
+ # or
53
+ # B) Conditionally copy a local pre-cache from the build context to the
54
+ # container's cache via the HF_PRECACHE_DIR build-arg.
55
+ # WARNING: This will copy ALL files in the pre-cache location.
56
+
57
+ # Conditionally copy a cache directory if provided
58
+ RUN if [ -n "$HF_PRECACHE_DIR" ]; then \
59
+ echo "Copying Hugging Face cache from $HF_PRECACHE_DIR"; \
60
+ mkdir -p /root/.cache/huggingface/hub && \
61
+ cp -r $HF_PRECACHE_DIR/* /root/.cache/huggingface/hub; \
62
+ else \
63
+ echo "No local Hugging Face cache specified, skipping copy"; \
64
+ fi
65
+
66
+ # Conditionally copy a Hugging Face token if provided
67
+
68
+ RUN if [ -n "$HF_TKN_FILE" ]; then \
69
+ echo "Copying Hugging Face token from $HF_TKN_FILE"; \
70
+ mkdir -p /root/.cache/huggingface && \
71
+ cp $HF_TKN_FILE /root/.cache/huggingface/token; \
72
+ else \
73
+ echo "No Hugging Face token file specified, skipping token setup"; \
74
+ fi
75
+
76
+ # Expose port for the transcription server
77
+ EXPOSE 8000
78
+
79
+ ENTRYPOINT ["whisperlivekit-server", "--host", "0.0.0.0"]
80
+
81
+ # Default args
82
+ CMD ["--model", "tiny.en"]