fish-speech-cpu / Dockerfile
abersbail's picture
Upload Dockerfile with huggingface_hub
b2b752f verified
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
ffmpeg \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Add non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Create working directory
WORKDIR $HOME/app
# Clone fish-speech
RUN git clone https://github.com/fishaudio/fish-speech.git .
# Install dependencies (CPU friendly)
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -e .
RUN pip install --no-cache-dir huggingface_hub gradio
# We need to expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# We create a custom runner script to start the webui on port 7860
RUN echo 'import sys\nsys.argv = ["webui.py", "--theme", "dark"]\nimport gradio as gr\nglobal app\n# Patch gradio launch to force host and port\noriginal_launch = gr.Blocks.launch\ndef patched_launch(self, *args, **kwargs):\n kwargs["server_name"] = "0.0.0.0"\n kwargs["server_port"] = 7860\n return original_launch(self, *args, **kwargs)\ngr.Blocks.launch = patched_launch\nimport tools.webui' > run.py
# Run the custom script
CMD ["python", "run.py"]