rrg92 commited on
Commit
aa855d8
1 Parent(s): 29eda7d

Changes to work in HF docker permission

Browse files
Files changed (2) hide show
  1. Dockerfile +57 -4
  2. docker-compose.yml +1 -0
Dockerfile CHANGED
@@ -1,7 +1,60 @@
1
- FROM fedirz/faster-whisper-server:latest-cuda
 
 
 
 
 
2
 
3
 
4
- RUN pip install ffmpeg-python
5
 
6
- RUN mkdir -p /data/hugging-face
7
- ENV HF_HOME /data/hugging-face
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # Fast Whisper Prepared to Hugging Face Docker!
3
+ # This file builds a fasst whisper that can run in Hugging Face Docker Space.
4
+ # HF Docker Space runs under user 1000, due this, some changes is need in build.
5
+ #
6
+ #
7
 
8
 
 
9
 
10
+ FROM alpine/git as src
11
+
12
+ WORKDIR /src
13
+ RUN git clone https://github.com/fedirz/faster-whisper-server .
14
+
15
+
16
+ FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04
17
+
18
+ RUN apt-get update
19
+ RUN apt install -y software-properties-common
20
+ RUN add-apt-repository ppa:deadsnakes/ppa
21
+
22
+
23
+ ENV DEBIAN_FRONTEND=noninteractive
24
+ RUN apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget ca-certificates curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev mecab-ipadic-utf8 git
25
+
26
+ RUN useradd -m -u 1000 user
27
+ USER user
28
+
29
+ WORKDIR /pyenv
30
+
31
+
32
+ ENV PYENV_ROOT /pyenv/pyenvroot
33
+ ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
34
+
35
+ ENV PYTHON_VERSION 3.12
36
+
37
+ RUN set -ex \
38
+ && curl https://pyenv.run | bash \
39
+ && pyenv update \
40
+ && pyenv install $PYTHON_VERSION \
41
+ && pyenv global $PYTHON_VERSION \
42
+ && pyenv rehash
43
+
44
+
45
+ WORKDIR /server
46
+
47
+
48
+ RUN pip install --no-cache-dir --upgrade pip
49
+ WORKDIR /app
50
+ COPY --chown=user --from=src /src/requirements.txt .
51
+ COPY --chown=user --from=src /src/faster_whisper_server ./faster_whisper_server
52
+
53
+ RUN pip install -r requirements.txt
54
+ RUN pip install uvicorn
55
+
56
+ ENV WHISPER__MODEL=Systran/faster-whisper-small
57
+ ENV WHISPER__INFERENCE_DEVICE=auto
58
+ ENV UVICORN_HOST=0.0.0.0
59
+ ENV UVICORN_PORT=8000
60
+ CMD ["python3.12","-m","uvicorn", "faster_whisper_server.main:app"]
docker-compose.yml CHANGED
@@ -3,6 +3,7 @@ volumes:
3
 
4
  services:
5
  wserver:
 
6
  build: .
7
  volumes:
8
  - hfcache:/data/hugging-face
 
3
 
4
  services:
5
  wserver:
6
+ user: "1000"
7
  build: .
8
  volumes:
9
  - hfcache:/data/hugging-face