sidmazak commited on
Commit
1046847
·
verified ·
1 Parent(s): 206ad97

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -10
Dockerfile CHANGED
@@ -1,10 +1,11 @@
1
- # Use a slim Python image as base
2
  FROM python:3.10-slim
3
 
4
- # Install system dependencies: ffmpeg (needed by ctc-forced-aligner)
5
- # and build-essential (compiler + build tools for C++ extension)
 
 
6
  RUN apt-get update && \
7
- apt-get install -y ffmpeg build-essential && \
8
  rm -rf /var/lib/apt/lists/*
9
 
10
  # ----- Redirect all caches to /tmp (mandatory for HF Spaces) -----
@@ -21,16 +22,44 @@ RUN mkdir -p ${TRANSFORMERS_CACHE} ${TORCH_HOME} && \
21
 
22
  WORKDIR /code
23
 
24
- # Copy and install Python dependencies
25
  COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # Copy the rest of the application (main.py)
29
  COPY . .
30
 
31
- # Expose port 7860 (Hugging Face Spaces standard)
32
  EXPOSE 7860
33
 
34
- # Run the FastAPI app (main.py -> main:app)
35
- # If your file is named "app.py", change to "app:app"
36
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM python:3.10-slim
2
 
3
+ # Install system dependencies:
4
+ # ffmpeg → required by ctc-forced-aligner
5
+ # build-essential → compilers (g++, make) for the C++ extension
6
+ # git → needed to pip install from GitHub
7
  RUN apt-get update && \
8
+ apt-get install -y ffmpeg build-essential git && \
9
  rm -rf /var/lib/apt/lists/*
10
 
11
  # ----- Redirect all caches to /tmp (mandatory for HF Spaces) -----
 
22
 
23
  WORKDIR /code
24
 
 
25
  COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
 
28
  COPY . .
29
 
 
30
  EXPOSE 7860
31
 
32
+ # Adjust the module name if your Python file is named app.py (app:app)
33
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]FROM python:3.10-slim
34
+
35
+ # Install system dependencies:
36
+ # ffmpeg → required by ctc-forced-aligner
37
+ # build-essential → compilers (g++, make) for the C++ extension
38
+ # git → needed to pip install from GitHub
39
+ RUN apt-get update && \
40
+ apt-get install -y ffmpeg build-essential git && \
41
+ rm -rf /var/lib/apt/lists/*
42
+
43
+ # ----- Redirect all caches to /tmp (mandatory for HF Spaces) -----
44
+ ENV NUMBA_CACHE_DIR=/tmp/numba_cache
45
+ ENV MPLCONFIGDIR=/tmp/matplotlib_cache
46
+ ENV XDG_CACHE_HOME=/tmp/xdg_cache
47
+ ENV HF_HOME=/tmp/hf_cache
48
+ ENV TRANSFORMERS_CACHE=/tmp/hf_cache/transformers
49
+ ENV TORCH_HOME=/tmp/hf_cache/torch
50
+ ENV HF_HUB_CACHE=/tmp/hf_cache/hub
51
+
52
+ RUN mkdir -p ${TRANSFORMERS_CACHE} ${TORCH_HOME} && \
53
+ chmod -R 777 /tmp/hf_cache
54
+
55
+ WORKDIR /code
56
+
57
+ COPY requirements.txt .
58
+ RUN pip install --no-cache-dir -r requirements.txt
59
+
60
+ COPY . .
61
+
62
+ EXPOSE 7860
63
+
64
+ # Adjust the module name if your Python file is named app.py (app:app)
65
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]