Hammad712 commited on
Commit
172ec82
·
verified ·
1 Parent(s): 360682b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -0
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base lightweight image
2
+ FROM python:3.10-slim
3
+
4
+ # Prevent Python from writing .pyc files and enable live terminal output (logging)
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Set working directory
9
+ WORKDIR /app
10
+
11
+ # Install system dependencies required for torchaudio (Crucial for Docker)
12
+ RUN apt-get update && apt-get install -y libsndfile1 && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Install Python dependencies
15
+ COPY requirements.txt .
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy application code
19
+ COPY . .
20
+
21
+ # Expose API port
22
+ EXPOSE 7860
23
+
24
+ # Start Production Server using Gunicorn with Uvicorn workers
25
+ CMD ["gunicorn", "app:app", "--workers", "2", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860"]