File size: 2,366 Bytes
d29d761
2485dd8
d29d761
 
 
 
 
2485dd8
d29d761
0697f18
d29d761
 
0cf5079
d29d761
0cf5079
d29d761
 
 
 
 
 
4b8eae9
d29d761
4b8eae9
 
d29d761
 
 
 
4b8eae9
d29d761
4b8eae9
d29d761
4b8eae9
d29d761
 
 
 
 
4b8eae9
d29d761
 
4b8eae9
d29d761
 
4b8eae9
d29d761
 
 
 
0697f18
d29d761
0697f18
d29d761
 
 
 
 
 
2485dd8
d29d761
 
 
2485dd8
d29d761
 
 
2485dd8
d29d761
 
 
 
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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