Dan Vancea commited on
Commit
40a853b
·
1 Parent(s): 8cafc70
Files changed (2) hide show
  1. Dockerfile +6 -9
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -13,21 +13,18 @@ RUN apt-get update && apt-get install -y \
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # 3. Create the unprivileged user required by Hugging Face Spaces (UID 1000)
17
- RUN useradd -m -u 1000 user
18
-
19
- # 4. Pre-create the cache directory and assign ownership to the new user.
20
- RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user/.cache
21
 
22
  # 5. Switch context to the unprivileged user
23
  USER user
24
  ENV HOME=/home/user
 
25
  WORKDIR $HOME/app
26
 
27
- # 6. Pre-download the faster-whisper base model into the image
28
- RUN python -c "from faster_whisper import WhisperModel; WhisperModel('base', device='cpu', compute_type='int8')"
29
-
30
- # 7. Copy the application code and transfer ownership
31
  COPY --chown=user . .
32
 
33
  EXPOSE 7860
 
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # 3. Create the unprivileged user and writable cache dir
17
+ RUN useradd -m -u 1000 user && \
18
+ mkdir -p /home/user/.cache/huggingface && \
19
+ chown -R user:user /home/user/.cache
 
20
 
21
  # 5. Switch context to the unprivileged user
22
  USER user
23
  ENV HOME=/home/user
24
+ ENV HF_HOME=/home/user/.cache/huggingface
25
  WORKDIR $HOME/app
26
 
27
+ # 6. Copy the application code
 
 
 
28
  COPY --chown=user . .
29
 
30
  EXPOSE 7860
requirements.txt CHANGED
@@ -2,4 +2,4 @@ flask==3.0.0
2
  flask-cors==4.0.0
3
  python-dotenv==1.0.0
4
  anthropic==0.18.0
5
- faster-whisper==1.1.1
 
2
  flask-cors==4.0.0
3
  python-dotenv==1.0.0
4
  anthropic==0.18.0
5
+ faster-whisper>=1.0.0