Bouaziz-bad commited on
Commit
b386b22
·
1 Parent(s): 3968f31

Introduce Dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +33 -19
  2. requirements.txt +3 -21
Dockerfile CHANGED
@@ -7,30 +7,44 @@ FROM docker.io/library/python:3.11-slim
7
  # Install system dependencies, including build tools and ffmpeg
8
  RUN apt-get update && apt-get install -y sox ffmpeg build-essential
9
 
10
- # Create a non-root user
11
- RUN useradd --create-home --shell /bin/bash appuser
12
- WORKDIR /home/appuser
13
 
14
- # Copy requirements file and set correct ownership
15
- COPY --chown=appuser:appuser requirements.txt .
16
 
17
- # Install all Python dependencies
18
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- # Switch to the non-root user
21
- USER appuser
22
 
23
- # Set the working directory for the application
24
- WORKDIR /home/appuser/app
25
 
26
- # Copy the application code and set correct ownership
27
- COPY --chown=appuser:appuser . .
 
 
 
28
 
29
- # Expose the port the app runs on
30
- EXPOSE 8000
31
 
32
- # Set the entrypoint for the container
33
- ENTRYPOINT ["gunicorn"]
34
 
35
- # Set the arguments for the entrypoint (this is your CMD)
36
- CMD ["--bind", "0.0.0.0:8000", "app:app"]
 
7
  # Install system dependencies, including build tools and ffmpeg
8
  RUN apt-get update && apt-get install -y sox ffmpeg build-essential
9
 
10
+ # Use Python 3.10 (best compatibility with NeMo 1.20.0)
11
+ FROM python:3.10-slim
 
12
 
13
+ # Set working directory
14
+ WORKDIR /app
15
 
16
+ # Install system dependencies
17
+ # build-essential for compiling youtokentome, ffmpeg/libsndfile for audio
18
+ RUN apt-get update && apt-get install -y \
19
+ build-essential \
20
+ ffmpeg \
21
+ libsndfile1 \
22
+ sox \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ # Copy requirements first
26
+ COPY requirements.txt .
27
+
28
+ # Install Cython FIRST (critical for youtokentome)
29
+ RUN pip install --no-cache-dir Cython
30
 
31
+ # Install torch before NeMo
32
+ RUN pip install --no-cache-dir torch==1.13.1 torchaudio==0.13.1
33
 
34
+ # Install pytorch-lightning with compatible version
35
+ RUN pip install --no-cache-dir "pytorch-lightning==1.9.4"
36
 
37
+ # Install youtokentome (now it can build with Cython)
38
+ RUN pip install --no-cache-dir youtokentome
39
+
40
+ # Install remaining requirements
41
+ RUN pip install --no-cache-dir -r requirements.txt
42
 
43
+ # Copy app files
44
+ COPY backend.py app.py ./
45
 
46
+ # Expose port (HFS expects 7860 for Gradio)
47
+ EXPOSE 7860
48
 
49
+ # Run Gradio app
50
+ CMD ["python", "app.py"]
requirements.txt CHANGED
@@ -1,23 +1,5 @@
1
- # Install Cython first
2
- Cython
3
-
4
- # Core PyTorch
5
- torch==1.13.1
6
- torchaudio==0.13.1
7
-
8
- # Compatible PyTorch Lightning
9
- pytorch-lightning==1.9.4
10
-
11
- # Other required
12
  omegaconf>=2.0
13
  hydra-core
14
- numpy<1.24.0
15
- gradio==4.25.0
16
-
17
- # Install youtokentome via pre-built wheel (avoid source build)
18
- --find-links https://download.pytorch.org/whl/torch_stable.html
19
- --prefer-binary
20
- youtokentome
21
-
22
- # Finally, install NeMo
23
- git+https://github.com/NVIDIA/[email protected]#egg=nemo_toolkit[asr]&subdirectory=.
 
1
+ gradio==4.25.0
2
+ numpy<1.24.0
 
 
 
 
 
 
 
 
 
3
  omegaconf>=2.0
4
  hydra-core
5
+ nemo_toolkit[asr]>=1.20.0