Update Dockerfile
Browse files- Dockerfile +3 -17
Dockerfile
CHANGED
|
@@ -2,15 +2,11 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
curl \
|
| 8 |
ffmpeg \
|
| 9 |
libsndfile1 \
|
| 10 |
-
build-essential \
|
| 11 |
-
cmake \
|
| 12 |
-
gcc \
|
| 13 |
-
g++ \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
# Create necessary directories
|
|
@@ -19,25 +15,15 @@ RUN mkdir -p /tmp/voices /tmp/output
|
|
| 19 |
# Copy requirements first for better caching
|
| 20 |
COPY requirements.txt .
|
| 21 |
|
| 22 |
-
# Install Python dependencies
|
| 23 |
RUN pip install --upgrade pip
|
| 24 |
-
RUN pip install --no-cache-dir --upgrade setuptools wheel
|
| 25 |
-
|
| 26 |
-
# Install CPU-only PyTorch first (lighter and more compatible)
|
| 27 |
-
RUN pip install --no-cache-dir torch==2.1.0+cpu torchaudio==2.1.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
| 28 |
-
|
| 29 |
-
# Then install other requirements
|
| 30 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 31 |
|
| 32 |
# Copy application code
|
| 33 |
COPY app.py .
|
| 34 |
|
| 35 |
-
# Create a non-root user (required by HuggingFace)
|
| 36 |
-
RUN useradd -m -u 1000 user
|
| 37 |
-
USER user
|
| 38 |
-
|
| 39 |
# Expose port
|
| 40 |
EXPOSE 8000
|
| 41 |
|
| 42 |
-
# Start the application
|
| 43 |
CMD ["python", "app.py"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
curl \
|
| 8 |
ffmpeg \
|
| 9 |
libsndfile1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# Create necessary directories
|
|
|
|
| 15 |
# Copy requirements first for better caching
|
| 16 |
COPY requirements.txt .
|
| 17 |
|
| 18 |
+
# Install Python dependencies
|
| 19 |
RUN pip install --upgrade pip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
# Copy application code
|
| 23 |
COPY app.py .
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Expose port
|
| 26 |
EXPOSE 8000
|
| 27 |
|
| 28 |
+
# Start the application (no user creation needed for HF Spaces)
|
| 29 |
CMD ["python", "app.py"]
|