tao-shen commited on
Commit
061eb93
·
verified ·
1 Parent(s): 625685e

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -8
Dockerfile CHANGED
@@ -1,19 +1,29 @@
 
1
  FROM python:3.12-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies (ffmpeg for pydub)
6
- RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
 
 
 
7
 
8
- COPY requirements.txt /app/requirements.txt
 
 
 
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- COPY . /app
 
 
 
 
12
 
13
- # Set environment variables for Gradio
14
  ENV GRADIO_SERVER_NAME="0.0.0.0"
15
- ENV PYTHONUNBUFFERED=1
16
- ENV PYTHON_VERSION=3.12
17
 
18
- # Direct execution to bypass shell layering issues
19
  CMD ["python", "app.py"]
 
1
+ # Use Python 3.12 to avoid pydub/pyaudioop conflict in 3.13
2
  FROM python:3.12-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies (ffmpeg is critical for pydub)
8
+ # Update apt lists and install in one layer to reduce image size
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ ffmpeg \
11
+ && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy requirements first for better caching
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies with explicit no-cache to prevent dirty builds
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy the rest of the application
20
+ COPY . .
21
+
22
+ # Expose the port Gradio will run on
23
+ EXPOSE 7860
24
 
25
+ # Set environment variable to ensure Gradio listens on the correct network
26
  ENV GRADIO_SERVER_NAME="0.0.0.0"
 
 
27
 
28
+ # Run the application
29
  CMD ["python", "app.py"]