Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +15 -34
Dockerfile
CHANGED
@@ -1,47 +1,28 @@
|
|
1 |
-
# ----------- START Dockerfile -----------
|
2 |
# Use an official Python runtime as a parent image
|
3 |
-
FROM python:3.10
|
4 |
-
|
5 |
-
# Set the working directory in the container
|
6 |
-
WORKDIR /app
|
7 |
|
8 |
# Set environment variables
|
9 |
-
|
10 |
-
|
11 |
-
ENV PYTHONUNBUFFERED=1 \
|
12 |
-
HF_HOME=/app/hf_cache
|
13 |
|
14 |
# Install system dependencies
|
15 |
-
|
16 |
-
# - build-essential: May be needed for compiling some Python dependencies
|
17 |
-
# - git: Sometimes needed if pip installs from git repositories
|
18 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
19 |
ffmpeg \
|
20 |
-
|
21 |
-
git \
|
22 |
-
&& apt-get clean \
|
23 |
&& rm -rf /var/lib/apt/lists/*
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
|
28 |
-
# Install Python dependencies
|
29 |
-
# Upgrade pip first, use --no-cache-dir to reduce image size
|
30 |
-
RUN pip install --no-cache-dir --upgrade pip && \
|
31 |
-
pip install --no-cache-dir -r requirements.txt
|
32 |
-
|
33 |
-
# Copy the model download script BEFORE the main app code
|
34 |
-
COPY download_models.py .
|
35 |
|
36 |
-
#
|
37 |
-
|
38 |
-
# NOTE: This step can take a LONG time and requires network access during build
|
39 |
-
RUN python download_models.py
|
40 |
|
41 |
-
#
|
42 |
-
|
|
|
43 |
|
|
|
44 |
EXPOSE 7860
|
45 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
46 |
|
47 |
-
#
|
|
|
|
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.10-slim
|
|
|
|
|
|
|
3 |
|
4 |
# Set environment variables
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
+
ENV PYTHONUNBUFFERED 1
|
|
|
|
|
7 |
|
8 |
# Install system dependencies
|
9 |
+
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
10 |
ffmpeg \
|
11 |
+
libsndfile1 \
|
|
|
|
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Set work directory
|
15 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
# Copy app files
|
18 |
+
COPY . /app/
|
|
|
|
|
19 |
|
20 |
+
# Install Python dependencies
|
21 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
22 |
+
&& pip install --no-cache-dir -r requirements.txt
|
23 |
|
24 |
+
# Expose port
|
25 |
EXPOSE 7860
|
|
|
26 |
|
27 |
+
# Command to run the FastAPI app with Uvicorn
|
28 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|