|
@@ -1,17 +1,13 @@
|
|
|
# Stage 1: Install dependencies (isolated layout, same as local dev)
|
|
# Stage 1: Install dependencies (isolated layout, same as local dev)
|
|
|
FROM node:22-bookworm AS deps
|
|
FROM node:22-bookworm AS deps
|
|
|
|
|
|
|
|
-# 使用阿里云镜像源
|
|
|
|
|
-RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
|
-
|
|
|
|
|
-ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com
|
|
|
|
|
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
|
|
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
RUN apt-get update && \
|
|
|
apt-get install -y --no-install-recommends ffmpeg python3 python3-pip && \
|
|
apt-get install -y --no-install-recommends ffmpeg python3 python3-pip && \
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
-RUN pip3 install --break-system-packages -i https://mirrors.aliyun.com/pypi/simple/ faster-whisper
|
|
|
|
|
|
|
+RUN pip3 install --break-system-packages faster-whisper
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
WORKDIR /app
|
|
|
|
|
|
|
@@ -24,8 +20,7 @@ COPY packages/tts/package.json packages/tts/
|
|
|
COPY packages/templates/package.json packages/templates/
|
|
COPY packages/templates/package.json packages/templates/
|
|
|
COPY packages/collect/package.json packages/collect/
|
|
COPY packages/collect/package.json packages/collect/
|
|
|
|
|
|
|
|
-RUN pnpm config set registry https://registry.npmmirror.com && \
|
|
|
|
|
- pnpm install --frozen-lockfile
|
|
|
|
|
|
|
+RUN pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
# Stage 2: Build
|
|
# Stage 2: Build
|
|
|
FROM deps AS build
|
|
FROM deps AS build
|
|
@@ -40,9 +35,6 @@ RUN pnpm build && rm -rf apps/web/.next/cache
|
|
|
# Stage 3: Runtime — fresh prod install with hoisted layout
|
|
# Stage 3: Runtime — fresh prod install with hoisted layout
|
|
|
FROM node:22-bookworm-slim AS runtime
|
|
FROM node:22-bookworm-slim AS runtime
|
|
|
|
|
|
|
|
-RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
|
-
|
|
|
|
|
-ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com
|
|
|
|
|
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
|
|
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
RUN apt-get update && \
|
|
@@ -53,7 +45,7 @@ RUN apt-get update && \
|
|
|
libgbm1 libpango-1.0-0 libcairo2 libasound2 && \
|
|
libgbm1 libpango-1.0-0 libcairo2 libasound2 && \
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
-RUN pip3 install --break-system-packages -i https://mirrors.aliyun.com/pypi/simple/ faster-whisper
|
|
|
|
|
|
|
+RUN pip3 install --break-system-packages faster-whisper
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
WORKDIR /app
|
|
|
|
|
|
|
@@ -68,8 +60,7 @@ COPY --from=build /app/packages/templates/package.json packages/templates/
|
|
|
COPY --from=build /app/packages/collect/package.json packages/collect/
|
|
COPY --from=build /app/packages/collect/package.json packages/collect/
|
|
|
|
|
|
|
|
# Install production deps with hoisted layout (everything flat at root node_modules)
|
|
# Install production deps with hoisted layout (everything flat at root node_modules)
|
|
|
-RUN pnpm config set registry https://registry.npmmirror.com && \
|
|
|
|
|
- pnpm install --frozen-lockfile --prod --config.node-linker=hoisted
|
|
|
|
|
|
|
+RUN pnpm install --frozen-lockfile --prod --config.node-linker=hoisted
|
|
|
|
|
|
|
|
# Re-create workspace symlinks at root so any package can resolve @pipeline/* by walking up
|
|
# Re-create workspace symlinks at root so any package can resolve @pipeline/* by walking up
|
|
|
RUN mkdir -p node_modules/@pipeline && \
|
|
RUN mkdir -p node_modules/@pipeline && \
|
|
@@ -101,10 +92,9 @@ RUN mkdir -p /usr/share/fonts/truetype/noto && \
|
|
|
|
|
|
|
|
# Bundle Remotion's headless Chrome so rendering needs NO network at runtime.
|
|
# Bundle Remotion's headless Chrome so rendering needs NO network at runtime.
|
|
|
# Remotion normally auto-downloads chrome-headless-shell from Google's CDN
|
|
# Remotion normally auto-downloads chrome-headless-shell from Google's CDN
|
|
|
-# (storage.googleapis.com / remotion.media) on first render, but that is
|
|
|
|
|
-# ~5KB/s from CN networks and stalls indefinitely. Fetch the SAME binary
|
|
|
|
|
-# Remotion wants from the Aliyun-backed npmmirror binary mirror at build time
|
|
|
|
|
-# and lay it out exactly as Remotion's BrowserFetcher expects, so
|
|
|
|
|
|
|
+# (storage.googleapis.com / remotion.media) on first render. Fetch the SAME
|
|
|
|
|
+# binary at build time from the official Chrome for Testing public bucket and
|
|
|
|
|
+# lay it out exactly as Remotion's BrowserFetcher expects, so
|
|
|
# ensureBrowser() finds it present (revision.local && existsSync(executablePath))
|
|
# ensureBrowser() finds it present (revision.local && existsSync(executablePath))
|
|
|
# and skips the download. Version is read from the installed @remotion/renderer
|
|
# and skips the download. Version is read from the installed @remotion/renderer
|
|
|
# so this auto-tracks Remotion upgrades instead of hardcoding a number.
|
|
# so this auto-tracks Remotion upgrades instead of hardcoding a number.
|
|
@@ -114,7 +104,7 @@ RUN set -eux; \
|
|
|
test -n "$VERSION"; \
|
|
test -n "$VERSION"; \
|
|
|
CACHE=/app/node_modules/.remotion/chrome-headless-shell; \
|
|
CACHE=/app/node_modules/.remotion/chrome-headless-shell; \
|
|
|
mkdir -p "$CACHE/linux64"; \
|
|
mkdir -p "$CACHE/linux64"; \
|
|
|
- URL="https://registry.npmmirror.com/-/binary/chrome-for-testing/${VERSION}/linux64/chrome-headless-shell-linux64.zip"; \
|
|
|
|
|
|
|
+ URL="https://storage.googleapis.com/chrome-for-testing-public/${VERSION}/linux64/chrome-headless-shell-linux64.zip"; \
|
|
|
node -e "const fs=require('fs');fetch(process.argv[1]).then(r=>r.arrayBuffer()).then(b=>fs.writeFileSync(process.argv[2],Buffer.from(b)))" "$URL" /tmp/chs.zip; \
|
|
node -e "const fs=require('fs');fetch(process.argv[1]).then(r=>r.arrayBuffer()).then(b=>fs.writeFileSync(process.argv[2],Buffer.from(b)))" "$URL" /tmp/chs.zip; \
|
|
|
python3 -m zipfile -e /tmp/chs.zip "$CACHE/linux64/"; \
|
|
python3 -m zipfile -e /tmp/chs.zip "$CACHE/linux64/"; \
|
|
|
rm -f /tmp/chs.zip; \
|
|
rm -f /tmp/chs.zip; \
|