Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -12
Dockerfile
CHANGED
|
@@ -2,19 +2,23 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
| 7 |
-
RUN mkdir -p /app/.cache/huggingface/hub && \
|
| 8 |
-
chmod -R 777 /app/.cache
|
| 9 |
-
|
| 10 |
-
# Install system dependencies
|
| 11 |
RUN apt-get update && \
|
| 12 |
apt-get install -y --no-install-recommends \
|
| 13 |
git \
|
| 14 |
curl \
|
|
|
|
|
|
|
| 15 |
espeak-ng \
|
|
|
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Install git-lfs via direct package installation
|
| 19 |
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
| 20 |
apt-get update && \
|
|
@@ -28,20 +32,23 @@ RUN git clone https://huggingface.co/hexgrad/Kokoro-82M
|
|
| 28 |
COPY requirements.txt .
|
| 29 |
COPY app/ ./app/
|
| 30 |
|
| 31 |
-
# Install Python dependencies
|
| 32 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
# Move model files
|
| 35 |
RUN mv Kokoro-82M/* ./ && \
|
| 36 |
rm -rf Kokoro-82M
|
| 37 |
|
| 38 |
-
# Set environment variables
|
| 39 |
ENV MKL_NUM_THREADS=4 \
|
| 40 |
NUMEXPR_NUM_THREADS=4 \
|
| 41 |
OMP_NUM_THREADS=4 \
|
| 42 |
OPENBLAS_NUM_THREADS=4
|
| 43 |
|
|
|
|
| 44 |
EXPOSE 7860
|
| 45 |
|
| 46 |
-
# Start
|
| 47 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies including gnupg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN apt-get update && \
|
| 7 |
apt-get install -y --no-install-recommends \
|
| 8 |
git \
|
| 9 |
curl \
|
| 10 |
+
ca-certificates \
|
| 11 |
+
gnupg \
|
| 12 |
espeak-ng \
|
| 13 |
+
software-properties-common \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
|
| 17 |
+
# Create cache directories with proper permissions
|
| 18 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
| 19 |
+
RUN mkdir -p /app/.cache/huggingface/hub && \
|
| 20 |
+
chmod -R 777 /app/.cache
|
| 21 |
+
|
| 22 |
# Install git-lfs via direct package installation
|
| 23 |
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
| 24 |
apt-get update && \
|
|
|
|
| 32 |
COPY requirements.txt .
|
| 33 |
COPY app/ ./app/
|
| 34 |
|
| 35 |
+
# Install Python dependencies with CPU-only PyTorch
|
| 36 |
+
RUN pip install --no-cache-dir -r requirements.txt \
|
| 37 |
+
&& pip uninstall -y torch \
|
| 38 |
+
&& pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
|
| 39 |
|
| 40 |
+
# Move model files to the correct location
|
| 41 |
RUN mv Kokoro-82M/* ./ && \
|
| 42 |
rm -rf Kokoro-82M
|
| 43 |
|
| 44 |
+
# Set environment variables for CPU optimization
|
| 45 |
ENV MKL_NUM_THREADS=4 \
|
| 46 |
NUMEXPR_NUM_THREADS=4 \
|
| 47 |
OMP_NUM_THREADS=4 \
|
| 48 |
OPENBLAS_NUM_THREADS=4
|
| 49 |
|
| 50 |
+
# Expose port
|
| 51 |
EXPOSE 7860
|
| 52 |
|
| 53 |
+
# Start the application with worker configuration
|
| 54 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4"]
|