Spaces:
Paused
Paused
Update dockerfile
Browse files- dockerfile +35 -27
dockerfile
CHANGED
|
@@ -1,37 +1,45 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
RUN apt-get update \
|
| 10 |
-
&& apt-get install -y git espeak \
|
| 11 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
-
|
| 13 |
-
# Install Python packages as root, including fastapi and uvicorn
|
| 14 |
-
# This avoids path issues with non-root users
|
| 15 |
-
RUN pip install --no-cache-dir --upgrade fastapi uvicorn[standard] soundfile
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
|
| 20 |
-
# Install dependencies
|
| 21 |
-
RUN pip install --no-cache-dir
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
RUN
|
| 25 |
|
| 26 |
-
# Copy the
|
| 27 |
-
|
| 28 |
-
COPY . .
|
| 29 |
|
| 30 |
-
#
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim-bookworm
|
| 2 |
+
|
| 3 |
+
# Set environment variables
|
| 4 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
+
ENV HF_HUB_ENABLE_HF_TRANSFER=1
|
| 6 |
+
ENV HF_HOME=/app/cache
|
| 7 |
+
ENV PYTHONUNBUFFERED=1
|
| 8 |
+
ENV CUDA_VISIBLE_DEVICES=""
|
| 9 |
+
|
| 10 |
+
# Install system dependencies
|
| 11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
+
git \
|
| 13 |
+
build-essential \
|
| 14 |
+
espeak-ng \
|
| 15 |
+
libsndfile1 \
|
| 16 |
+
ffmpeg \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Set the working directory
|
| 20 |
WORKDIR /app
|
| 21 |
|
| 22 |
+
# Create and permission the cache directory
|
| 23 |
+
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
# Copy requirements first for better caching
|
| 26 |
+
COPY requirements.txt .
|
| 27 |
|
| 28 |
+
# Install Python dependencies
|
| 29 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
+
# Clone NeuTTS Air repository
|
| 32 |
+
RUN git clone https://github.com/neuphonic/neutts-air.git
|
| 33 |
|
| 34 |
+
# Copy the application code
|
| 35 |
+
COPY app.py .
|
|
|
|
| 36 |
|
| 37 |
+
# Expose the port
|
| 38 |
EXPOSE 7860
|
| 39 |
|
| 40 |
+
# Health check
|
| 41 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 42 |
+
CMD curl -f http://localhost:7860/health || exit 1
|
| 43 |
+
|
| 44 |
+
# Command to run the application
|
| 45 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|