mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-22 14:38:11 +02:00
fix: resolve music URL 404 and revert Dockerfile to Alpine + gcompat
- Convert relative music track URLs to absolute before passing to Remotion renderer - Reverts Dockerfile from Debian-slim back to Alpine + gcompat/libc6-compat for lighter image Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa01c7a7fd
commit
eba9c9da5e
2 files changed
+24
-43
No files matched your search
+22
-42
@@ -1,45 +1,26 @@
|
|||||||
# Node.js 20 Debian slim — glibc requis pour Remotion Chrome headless shell
|
# Alpine léger + gcompat pour la compatibilité glibc (requis par Remotion Chrome headless)
|
||||||
FROM node:20-slim
|
FROM node:20-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Dépendances système : build tools, canvas/sharp, fonts, ffmpeg + dépendances Chrome (glibc)
|
# Augmenter la mémoire dès le début (npm install + build)
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
|
|
||||||
|
# Dépendances système
|
||||||
|
RUN apk add --no-cache \
|
||||||
python3 make g++ \
|
python3 make g++ \
|
||||||
libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev libpixman-1-dev \
|
cairo-dev jpeg-dev pango-dev giflib-dev pixman-dev \
|
||||||
libvips-dev pkg-config \
|
vips-dev pkgconfig \
|
||||||
fonts-dejavu-core fontconfig \
|
ttf-dejavu fontconfig \
|
||||||
curl tar bzip2 \
|
curl tar bzip2 \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
libcap2-bin \
|
libcap \
|
||||||
ca-certificates \
|
# gcompat = couche de compatibilité glibc → permet au Chrome headless de Remotion de tourner sur Alpine
|
||||||
libasound2 \
|
gcompat \
|
||||||
libatk-bridge2.0-0 \
|
libc6-compat \
|
||||||
libatk1.0-0 \
|
# Dépendances Chromium pour le rendu headless
|
||||||
libcups2 \
|
chromium \
|
||||||
libdbus-1-3 \
|
nss freetype harfbuzz ca-certificates
|
||||||
libdrm2 \
|
|
||||||
libgbm1 \
|
|
||||||
libglib2.0-0 \
|
|
||||||
libgtk-3-0 \
|
|
||||||
libnspr4 \
|
|
||||||
libnss3 \
|
|
||||||
libpango-1.0-0 \
|
|
||||||
libx11-6 \
|
|
||||||
libx11-xcb1 \
|
|
||||||
libxcb1 \
|
|
||||||
libxcomposite1 \
|
|
||||||
libxdamage1 \
|
|
||||||
libxext6 \
|
|
||||||
libxfixes3 \
|
|
||||||
libxkbcommon0 \
|
|
||||||
libxrandr2 \
|
|
||||||
libxshmfence1 \
|
|
||||||
libxtst6 \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Augmenter la mémoire dès maintenant (npm install + build)
|
|
||||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
|
||||||
|
|
||||||
# Copier les fichiers de configuration
|
# Copier les fichiers de configuration
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
@@ -50,7 +31,7 @@ RUN npm install --legacy-peer-deps --no-audit --no-fund
|
|||||||
# Copier tout le code source
|
# Copier tout le code source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Télécharger et installer la police DejaVu Sans pour le rendu de texte
|
# Télécharger et installer la police DejaVu Sans
|
||||||
RUN mkdir -p server/fonts && \
|
RUN mkdir -p server/fonts && \
|
||||||
cd server/fonts && \
|
cd server/fonts && \
|
||||||
curl -L -f --retry 3 --retry-delay 2 -o dejavu.tar.bz2 "https://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2/download" && \
|
curl -L -f --retry 3 --retry-delay 2 -o dejavu.tar.bz2 "https://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2/download" && \
|
||||||
@@ -68,18 +49,17 @@ RUN rm -rf client/node_modules \
|
|||||||
node_modules/.cache \
|
node_modules/.cache \
|
||||||
/tmp/remotion-*
|
/tmp/remotion-*
|
||||||
|
|
||||||
# Pré-bundler la composition Remotion pendant le build
|
# Pré-bundler la composition Remotion
|
||||||
RUN node scripts/prebundle-remotion.js || true
|
RUN node scripts/prebundle-remotion.js || true
|
||||||
|
|
||||||
# Télécharger le Chrome headless shell de Remotion (binaire glibc, compatible Debian)
|
# Télécharger le Chrome headless shell de Remotion
|
||||||
|
# gcompat permet au binaire glibc de tourner sur Alpine
|
||||||
RUN npx remotion browser ensure && echo "✓ Remotion browser prêt"
|
RUN npx remotion browser ensure && echo "✓ Remotion browser prêt"
|
||||||
|
|
||||||
# Exposer le port de l'application
|
# Exposer le port
|
||||||
EXPOSE 5555
|
EXPOSE 5555
|
||||||
|
|
||||||
# Variables d'environnement par défaut
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV PORT=5555
|
ENV PORT=5555
|
||||||
|
|
||||||
# Démarrer l'application
|
|
||||||
CMD ["npm", "run", "start"]
|
CMD ["npm", "run", "start"]
|
||||||
@@ -115,9 +115,10 @@ remotionRouter.post("/render", upload.fields([{ name: "images", maxCount: 4 }, {
|
|||||||
|
|
||||||
// Music: uploaded file takes priority, else use catalog track URL directly
|
// Music: uploaded file takes priority, else use catalog track URL directly
|
||||||
const musicFile = fields["music"]?.[0];
|
const musicFile = fields["music"]?.[0];
|
||||||
|
const rawMusicTrackUrl = req.body.musicTrackUrl as string | undefined;
|
||||||
const musicUrl: string | undefined = musicFile
|
const musicUrl: string | undefined = musicFile
|
||||||
? `${host}/uploads/temp/${path.basename(musicFile.path)}`
|
? `${host}/uploads/temp/${path.basename(musicFile.path)}`
|
||||||
: (req.body.musicTrackUrl as string | undefined) || undefined;
|
: rawMusicTrackUrl?.startsWith('/') ? `${host}${rawMusicTrackUrl}` : rawMusicTrackUrl || undefined;
|
||||||
|
|
||||||
const fps = 30;
|
const fps = 30;
|
||||||
const totalVideoDuration = imageUrls.length * 3; // 3s per image
|
const totalVideoDuration = imageUrls.length * 3; // 3s per image
|
||||||
|
|||||||
Reference in new issue
Block a user