Spaces:
Sleeping
Sleeping
Commit ·
5516b13
1
Parent(s): 2a4d245
Feat: ADD Dockerized the API
Browse files- Dockerfile +28 -0
Dockerfile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official Python image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies (ffmpeg is required for audio processing)
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
ffmpeg \
|
| 7 |
+
libsndfile1 \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# Set working directory
|
| 11 |
+
WORKDIR /code
|
| 12 |
+
|
| 13 |
+
# Copy requirements and install
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Copy the application code
|
| 18 |
+
COPY ./app ./app
|
| 19 |
+
|
| 20 |
+
# Create a dummy model folder if needed (though we download from HF via code)
|
| 21 |
+
RUN mkdir -p /code/model
|
| 22 |
+
|
| 23 |
+
# Set environment variables
|
| 24 |
+
# HF Spaces uses port 7860 by default
|
| 25 |
+
ENV PORT=7860
|
| 26 |
+
|
| 27 |
+
# Command to run the API
|
| 28 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|