rairo commited on
Commit
a13d171
·
verified ·
1 Parent(s): 9b10f76

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -29
Dockerfile CHANGED
@@ -1,35 +1,37 @@
1
- FROM python:3.10
2
-
3
- # FIXED: Added ffmpeg and other required libraries to the existing system dependency installation.
4
- # This is the only line that has been changed.
5
- RUN apt-get update && apt-get install -y libgl1-mesa-glx ffmpeg libsm6 libxext6
6
-
7
- ### Set up user with permissions
8
- # Set up a new user named "user" with user ID 1000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  RUN useradd -m -u 1000 user
10
-
11
- # Switch to the "user" user
12
  USER user
13
-
14
- # Set home to the user's home directory
15
  ENV HOME=/home/user \
16
  PATH=/home/user/.local/bin:$PATH
17
 
18
- # Set the working directory to the user's home directory
19
- WORKDIR $HOME/app
20
-
21
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
22
- COPY --chown=user . $HOME/app
23
-
24
- ### Set up app-specific content
25
- COPY requirements.txt requirements.txt
26
- RUN pip3 install -r requirements.txt
27
-
28
- COPY . .
29
-
30
- ### Update permissions for the app
31
- USER root
32
- RUN chmod 777 ~/app/*
33
- USER user
34
 
35
- CMD ["python", "main.py"]
 
 
1
+ # Use Python 3.10 as base
2
+ FROM python:3.10-slim
3
+
4
+ # 1. Install System Dependencies
5
+ # libgl1-mesa-glx: Required for OpenCV
6
+ # libasound2-dev & libssl-dev: Required for Azure Speech SDK
7
+ # ffmpeg: Helper for audio processing
8
+ RUN apt-get update && apt-get install -y \
9
+ libgl1-mesa-glx \
10
+ libglib2.0-0 \
11
+ libasound2 \
12
+ libasound2-plugins \
13
+ libssl-dev \
14
+ ffmpeg \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # 2. Setup Work Directory
18
+ WORKDIR /app
19
+
20
+ # 3. Install Python Dependencies
21
+ COPY requirements.txt .
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # 4. Copy Server Code
25
+ COPY app.py .
26
+
27
+ # 5. Security: Create non-root user (Mandatory for HF Spaces)
28
  RUN useradd -m -u 1000 user
 
 
29
  USER user
 
 
30
  ENV HOME=/home/user \
31
  PATH=/home/user/.local/bin:$PATH
32
 
33
+ # 6. Expose the specific HF port
34
+ EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ # 7. Start Command using Gunicorn + Eventlet
37
+ CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:7860", "app:app"]