video / Dockerfile
tommy24's picture
Update Dockerfile
465a5ed verified
# # # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# # FROM python:3.9
# # # Install Node.js, Chromium, FFmpeg, and dependencies
# # RUN apt-get update && apt-get install -y \
# # curl \
# # chromium \
# # chromium-driver \
# # ffmpeg \
# # fonts-noto-color-emoji \
# # && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
# # && apt-get install -y nodejs \
# # && rm -rf /var/lib/apt/lists/*
# # # Create non-root user
# # RUN useradd -m -u 1000 user
# # USER user
# # ENV PATH="/home/user/.local/bin:$PATH"
# # WORKDIR /app
# # # Install Python dependencies
# # COPY --chown=user ./requirements.txt requirements.txt
# # RUN pip install --no-cache-dir --upgrade -r requirements.txt
# # # Copy and install Node dependencies
# # COPY --chown=user ./remotion/package*.json ./remotion/
# # RUN cd remotion && npm install
# # # Copy all files
# # COPY --chown=user . /app
# # # Set environment variables for Remotion
# # ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# # ENV PUPPETEER_SKIP_DOWNLOAD=true
# # # Expose port 7860 (HF Spaces standard)
# # EXPOSE 7860
# # # Run FastAPI app
# # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
# # # Base image with Node + Python
# # FROM node:22-bookworm-slim
# # # Install Chrome dependencies + ffmpeg + fonts
# # RUN apt-get update && apt-get install -y \
# # libnss3 libdbus-1-3 libatk1.0-0 libgbm-dev libasound2 \
# # libxrandr2 libxkbcommon-dev libxfixes3 libxcomposite1 libxdamage1 \
# # libatk-bridge2.0-0 libcups2 libpango-1.0-0 libcairo2 \
# # fonts-noto-color-emoji fonts-noto-cjk ffmpeg curl python3 python3-pip \
# # && rm -rf /var/lib/apt/lists/*
# # # Set working directory
# # WORKDIR /app
# # # Copy Python dependencies first
# # COPY requirements.txt .
# # RUN pip install --no-cache-dir --break-system-packages -r requirements.txt
# # # Copy Remotion project
# # COPY remotion/package*.json remotion/
# # ENV PUPPETEER_SKIP_DOWNLOAD=true
# # ENV REMOTION_BROWSER_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --single-process --disable-background-timer-throttling"
# # RUN cd remotion && npm install
# # # Copy everything else
# # COPY . .
# # # Install Chromium for Remotion
# # RUN cd remotion && npx remotion browser ensure
# # # Expose FastAPI port
# # EXPOSE 7860
# # # Run FastAPI
# # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
# # Use Node 22 slim as base
# FROM node:22-bookworm-slim
# # Install Chrome dependencies + ffmpeg + fonts
# RUN apt-get update && apt-get install -y \
# libnss3 libdbus-1-3 libatk1.0-0 libgbm-dev libasound2 \
# libxrandr2 libxkbcommon-dev libxfixes3 libxcomposite1 libxdamage1 \
# libatk-bridge2.0-0 libcups2 libpango-1.0-0 libcairo2 \
# fonts-noto-color-emoji fonts-noto-cjk ffmpeg curl \
# && rm -rf /var/lib/apt/lists/*
# # Set working directory
# WORKDIR /app
# # Copy Remotion project
# COPY remotion ./remotion
# # Install Node dependencies
# RUN cd remotion && npm install
# # Set Puppeteer / Remotion browser env
# ENV PUPPETEER_SKIP_DOWNLOAD=true
# ENV REMOTION_BROWSER_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --single-process --disable-background-timer-throttling"
# # Ensure Chrome Headless Shell is installed
# RUN cd remotion && npx remotion browser ensure
# # Expose port if using express
# EXPOSE 3000
# # Default command (you can point this to a Node API entry)
# CMD ["node", "remotion/render.mjs"]
FROM python:3.12-slim
RUN apt-get update && apt-get install -y git ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN git clone https://github.com/travisvn/chatterbox-tts-api .
RUN pip install --upgrade pip setuptools wheel
CMD ["python", "-m", "chatterbox_tts_api"]