seamless-streaming / Dockerfile
surenreddy's picture
Update Dockerfile
d29d761 verified
# syntax=docker/dockerfile:1.6
############################
# 1) Frontend build stage
############################
FROM node:20-alpine AS frontend-build
WORKDIR /app
RUN apk add --no-cache libc6-compat
# Copy frontend
COPY streaming-react-app/ ./
# Install deps + build using the correct package manager
RUN set -eux; \
if [ -f yarn.lock ]; then \
corepack enable && yarn --frozen-lockfile && yarn build; \
elif [ -f package-lock.json ]; then \
npm ci && npm run build; \
elif [ -f pnpm-lock.yaml ]; then \
corepack enable && pnpm i --frozen-lockfile && pnpm build; \
else \
echo "Lockfile not found." && exit 1; \
fi
############################
# 2) Backend build stage
############################
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS backend-build
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /build
# System deps for building wheels + audio/video runtime deps (build stage)
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 python3.10-venv python3-pip \
git curl ca-certificates \
build-essential pkg-config cmake \
libsndfile1-dev \
sox libsox-dev libsox-fmt-all \
ffmpeg \
libjpeg-dev libpng-dev \
&& rm -rf /var/lib/apt/lists/*
# Some libs/tools expect libsox.so (Ubuntu provides libsox.so.3)
RUN ln -sf /usr/lib/x86_64-linux-gnu/libsox.so.3 /usr/lib/x86_64-linux-gnu/libsox.so || true
# Create venv
ENV VENV=/opt/venv
RUN python3.10 -m venv ${VENV}
ENV PATH="${VENV}/bin:${PATH}"
RUN python -m pip install --no-cache-dir -U pip setuptools wheel
# (Optional but recommended) install CUDA-enabled torch that matches cu118
# If you already pin torch elsewhere, you can remove this block.
ARG TORCH_VERSION=2.1.1
RUN set -eux; \
pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu118 \
"torch==${TORCH_VERSION}+cu118" "torchaudio==${TORCH_VERSION}+cu118" || true
# Copy backend code
COPY seamless_server/ /build/seamless_server/
WORKDIR /build/seamless_server
# Install fairseq2 first
RUN pip install --no-cache-dir \
fairseq2 --pre --extra-index-url https://fair.pkg.atmeta.com/fairseq2/whl/nightly/pt2.1.1/cu118
# Install requirements:
# - install everything except parallel-wavegan normally
# - install parallel-wavegan with build isolation disabled (fixes "No module named pip")
RUN set -e