Spaces:
Building
Building
Update Dockerfile
Browse files- Dockerfile +15 -9
Dockerfile
CHANGED
@@ -1,23 +1,29 @@
|
|
1 |
# Use a lightweight Python image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
#
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Install system dependencies
|
8 |
-
RUN apt-get update &&
|
|
|
|
|
9 |
|
10 |
-
# Copy
|
11 |
COPY requirements.txt .
|
12 |
|
13 |
-
#
|
14 |
-
RUN pip install --upgrade pip &&
|
|
|
15 |
|
16 |
-
# Copy the source code
|
17 |
COPY . .
|
18 |
|
19 |
-
# Expose port (
|
20 |
EXPOSE 7860
|
21 |
|
22 |
-
#
|
|
|
|
|
|
|
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"]
|