Spaces:
Paused
Paused
File size: 1,226 Bytes
a64cb3d 5c31db9 e8ceee6 5c31db9 e8ceee6 5c31db9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# Use a newer PyTorch image that matches chatterbox-tts requirements
FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PORT=7860
# Set the working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
libsndfile1 \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Create a non-root user and switch to it
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /app
# Create output directory and set permissions before switching user
RUN mkdir -p /app/outputs && chown user:user /app/outputs
# Copy the rest of the application code
COPY --chown=user . .
USER user
# Pre-download the model weights during build time
RUN python download_model.py
# Expose the port (Hugging Face Spaces expects 7860)
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|