cosyvoice3-endpoint / DockerFile
Ram
Adding DockerFile
f52cf1a
Raw
History Blame Contribute Delete
1.28 kB
# Base image: HF-style PyTorch GPU environment
FROM huggingface/transformers-pytorch-gpu:latest
# Avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# System deps (adjust as needed: ffmpeg, sox, libsndfile, etc.)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
sox \
libsndfile1 && \
rm -rf /var/lib/apt/lists/*
# Workdir for app code
WORKDIR /app
# Copy your repo code (same structure as your HF endpoint repo)
# If you build from local checkout:
COPY . /app
# Or if you want to clone from HF Hub instead, comment COPY above and use:
# RUN git clone https://huggingface.co/YOUR_USER/YOUR_COSYVOICE_REPO /app
# Install Python deps
# You should have a requirements.txt in the repo that includes:
# fastapi, uvicorn[standard], cosyvoice deps (torch, onnxruntime, pyworld, soundfile, etc.)
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Expose API port
EXPOSE 8000
# Optional: envs for prod behavior
ENV PYTHONUNBUFFERED=1 \
UVICORN_HOST=0.0.0.0 \
UVICORN_PORT=8000
# Start FastAPI app with Uvicorn
# Assumes you have server.py with `app = FastAPI()` at top-level
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"]