peace2024 commited on
Commit
0889e65
·
1 Parent(s): 6d01d5b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -9
Dockerfile CHANGED
@@ -1,23 +1,29 @@
1
  # Use a lightweight Python image
2
  FROM python:3.10-slim
3
 
4
- # Create app directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
 
 
9
 
10
- # Copy dependency files
11
  COPY requirements.txt .
12
 
13
- # Install Python deps
14
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
15
 
16
- # Copy the source code
17
  COPY . .
18
 
19
- # Expose port (default for Hugging Face Spaces)
20
  EXPOSE 7860
21
 
22
- # Run app using Uvicorn
 
 
 
23
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use a lightweight Python image
2
  FROM python:3.10-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system-level dependencies
8
+ RUN apt-get update && \
9
+ apt-get install -y ffmpeg libsndfile1 wget curl git && \
10
+ rm -rf /var/lib/apt/lists/*
11
 
12
+ # Copy requirements first to leverage Docker layer caching
13
  COPY requirements.txt .
14
 
15
+ # Upgrade pip and install dependencies
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy the entire app source code
20
  COPY . .
21
 
22
+ # Expose port 7860 (used by Hugging Face Spaces)
23
  EXPOSE 7860
24
 
25
+ # Set environment variables (if needed)
26
+ ENV PYTHONUNBUFFERED=1
27
+
28
+ # Run the FastAPI app via Uvicorn
29
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]