mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
feat: Add Remotion video rendering endpoint with image and TTS support, and enhance Dockerfile's Chromium detection logic.
This commit is contained in:
1 parent
468e65091f
commit
fa4e6e3131
2 files changed
+20
-7
No files matched your search
+9
-4
@@ -73,11 +73,16 @@ RUN rm -rf client/node_modules \
|
||||
# Pré-bundler la composition Remotion pendant le build (speedup au premier rendu)
|
||||
RUN node scripts/prebundle-remotion.js || true
|
||||
|
||||
# Vérifier que le binaire Chromium système est bien présent (utilisé à la place du binaire Remotion)
|
||||
# Trouver le binaire Chromium système et enregistrer son chemin pour l'utiliser au runtime
|
||||
# Note: npx remotion browser ensure télécharge un binaire glibc qui ne fonctionne pas sur Alpine (musl)
|
||||
RUN which chromium-browser && echo "✓ chromium-browser trouvé à $(which chromium-browser)" || \
|
||||
(which chromium && echo "✓ chromium trouvé à $(which chromium)") || \
|
||||
echo "⚠ Aucun chromium système trouvé — le rendu échouera"
|
||||
RUN CHROMIUM_BIN=$(which chromium-browser 2>/dev/null || which chromium 2>/dev/null || find /usr -name 'chrome' -o -name 'chromium' -o -name 'chromium-browser' 2>/dev/null | grep -v '/\.' | head -1) && \
|
||||
if [ -n "$CHROMIUM_BIN" ]; then \
|
||||
echo "✓ Chromium trouvé: $CHROMIUM_BIN" && \
|
||||
echo "$CHROMIUM_BIN" > /app/.chromium-path; \
|
||||
else \
|
||||
echo "⚠ Aucun chromium trouvé — le rendu échouera"; \
|
||||
fi && \
|
||||
cat /app/.chromium-path 2>/dev/null || true
|
||||
|
||||
|
||||
# Exposer le port de l'application
|
||||
|
||||
@@ -171,9 +171,17 @@ remotionRouter.post("/render", upload.array("images", 4), async (req, res) => {
|
||||
|
||||
console.log("🎬 Rendering media...", effectiveDurationInFrames, "frames");
|
||||
|
||||
// Standard Chromium paths — Alpine installs at /usr/bin/chromium-browser, Debian/Ubuntu may differ
|
||||
const chromiumPaths = ["/usr/bin/chromium-browser", "/usr/bin/chromium"];
|
||||
const browserExecutable = chromiumPaths.find(p => fs.existsSync(p));
|
||||
// Find system Chromium: path written during Docker build, or fallback to common locations
|
||||
let browserExecutable: string | undefined;
|
||||
const savedPath = "/app/.chromium-path";
|
||||
if (fs.existsSync(savedPath)) {
|
||||
const p = fs.readFileSync(savedPath, "utf-8").trim();
|
||||
if (p && fs.existsSync(p)) browserExecutable = p;
|
||||
}
|
||||
if (!browserExecutable) {
|
||||
const chromiumPaths = ["/usr/bin/chromium-browser", "/usr/bin/chromium"];
|
||||
browserExecutable = chromiumPaths.find(p => fs.existsSync(p));
|
||||
}
|
||||
console.log("🌐 Browser executable:", browserExecutable ?? "remotion bundled (fallback)");
|
||||
|
||||
await renderMedia({
|
||||
|
||||
Reference in new issue
Block a user