Skip to content

🎥 Make videos programmatically with React

Docker: Recommend node-22-bookworm-slim and update Cloud Run Image

Jonny Burgerd805bd4e6aec
diff --git a/packages/cloudrun/container/Dockerfile b/packages/cloudrun/container/Dockerfile
index 8e2ea178a2..6bcef41695 100644
--- a/packages/cloudrun/container/Dockerfile
+++ b/packages/cloudrun/container/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:20-bookworm
+FROM node:22-bookworm-slim
WORKDIR /usr/app
@@ -10,6 +10,7 @@ RUN node /usr/app/ensure.mjs
RUN apt update
RUN apt install -y \
+ git \
libnss3 \
libdbus-1-3 \
libatk1.0-0 \
@@ -21,6 +22,8 @@ RUN apt install -y \
libxcomposite1 \
libxdamage1 \
libatk-bridge2.0-0 \
+ libpango-1.0-0 \
+ libcairo2 \
libcups2
RUN npm config set update-notifier false
diff --git a/packages/cloudrun/container/ensure-browser.mjs b/packages/cloudrun/container/ensure-browser.mjs
index 7e5982b235..65d8f5cac0 100644
--- a/packages/cloudrun/container/ensure-browser.mjs
+++ b/packages/cloudrun/container/ensure-browser.mjs
@@ -2743,6 +2743,9 @@ var Log = {
verbose: (options, ...args) => {
writeInRepro("verbose", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "verbose")) {
+ if (args.length === 0) {
+ return process.stdout.write("\n");
+ }
return console.log(...[
options.indent ? INDENT_TOKEN : null,
options.tag ? verboseTag(options.tag) : null
@@ -2752,18 +2755,27 @@ var Log = {
info: (options, ...args) => {
writeInRepro("info", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "info")) {
- return console.log(...[options.indent ? INDENT_TOKEN : null].filter(truthy).concat(args));
+ if (args.length === 0) {
+ return process.stdout.write("\n");
+ }
+ return console.log(...[options.indent ? INDENT_TOKEN : null].filter(truthy).concat(args ?? []));
}
},
warn: (options, ...args) => {
writeInRepro("warn", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "warn")) {
+ if (args.length === 0) {
+ return process.stdout.write("\n");
+ }
return console.warn(...[options.indent ? chalk.yellow(INDENT_TOKEN) : null].filter(truthy).concat(args.map((a) => chalk.yellow(a))));
}
},
error: (options, ...args) => {
writeInRepro("error", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "error")) {
+ if (args.length === 0) {
+ return process.stdout.write("\n");
+ }
return console.error(...[
options.indent ? INDENT_TOKEN : null,
options.tag ? verboseTag(options.tag) : null
diff --git a/packages/dockerfiles/Dockerfile.debian b/packages/dockerfiles/Dockerfile.debian
index f6def21228..97d597c5e6 100644
--- a/packages/dockerfiles/Dockerfile.debian
+++ b/packages/dockerfiles/Dockerfile.debian
@@ -1,11 +1,10 @@
-FROM node:20-bookworm
+FROM node:22-bookworm-slim
RUN apt update
WORKDIR /usr/app
-RUN git clone https://github.com/remotion-dev/template-helloworld /usr/app
-RUN cd /usr/app
-RUN npm i
+
RUN apt install -y \
+ git \
libnss3 \
libdbus-1-3 \
libatk1.0-0 \
@@ -17,5 +16,11 @@ RUN apt install -y \
libxcomposite1 \
libxdamage1 \
libatk-bridge2.0-0 \
- libcups2
+ libpango-1.0-0 \
+ libcups2 \
+ libcairo2
+
+RUN git clone https://github.com/remotion-dev/template-helloworld /usr/app
+RUN cd /usr/app
+RUN npm i
RUN npx remotion compositions
diff --git a/packages/docs/docs/docker.mdx b/packages/docs/docs/docker.mdx
index 68ce7797bb..f47dd51de8 100644
--- a/packages/docs/docs/docker.mdx
+++ b/packages/docs/docs/docker.mdx
@@ -3,13 +3,13 @@ image: /generated/articles-docs-docker.png
id: docker
sidebar_label: Docker
title: Dockerizing a Remotion app
-crumb: "Building video apps"
+crumb: 'Building video apps'
---
We recommend the following structure for your Dockerfile. Read below about the individual steps and whether you need to adjust them.
```docker title="Dockerfile"
-FROM node:20-bookworm
+FROM node:22-bookworm-slim
# Install Chrome dependencies
RUN apt-get update
@@ -25,6 +25,8 @@ RUN apt install -y \
libxcomposite1 \
libxdamage1 \
libatk-bridge2.0-0 \
+ libpango-1.0-0 \
+ libcairo2 \
libcups2
# Copy everything from your project to the Docker image. Adjust if needed.
@@ -61,11 +63,13 @@ This Dockerfile is unable to render WebGL content. Suggestions on how to improve
</p>
```docker
-FROM node:20-bookworm
+FROM node:22-bookworm-slim
```
<p>
- <Step>2</Step> Update the package lists on the Debian system and install the needed [shared libraries](/docs/miscellaneous/linux-dependencies) for Chrome Headless Shell.
+ <Step>2</Step> Update the package lists on the Debian system and install the
+ needed [shared libraries](/docs/miscellaneous/linux-dependencies) for Chrome
+ Headless Shell.
</p>
```docker
@@ -85,12 +89,11 @@ RUN apt install -y \
libcups2
```
-
<p>
<Step>3</Step> Copy the files from your project. If you have additional source
- files, add them here. If some files do not exist, remove them. The{" "}
+ files, add them here. If some files do not exist, remove them. The{' '}
<code>COPY</code> syntax allows multiple files, but at least one file must
- exist. It is assumed <code>package.json</code>, <code>src</code> and{" "}
+ exist. It is assumed <code>package.json</code>, <code>src</code> and{' '}
<code>public</code> exist in your project, but you can adjust this to your
needs.
</p>
@@ -124,7 +127,8 @@ COPY public ./public
```
<p>
- <Step>5</Step> Install [Chrome Headless Shell](/docs/miscellaneous/chrome-headless-shell).
+ <Step>5</Step> Install [Chrome Headless
+ Shell](/docs/miscellaneous/chrome-headless-shell).
</p>
```docker
@@ -147,14 +151,14 @@ Assuming you want to render the composition `MyComp`:
```tsx twoslash title="render.mjs"
// @module: ESNext
// @target: ESNext
-import { bundle } from "@remotion/bundler";
-import { renderMedia, selectComposition } from "@remotion/renderer";
-import { createRequire } from "node:module";
+import {bundle} from '@remotion/bundler';
+import {renderMedia, selectComposition} from '@remotion/renderer';
+import {createRequire} from 'node:module';
const require = createRequire(import.meta.url);
const bundled = await bundle({
- entryPoint: require.resolve("./src/index.ts"),
+ entryPoint: require.resolve('./src/index.ts'),
// If you have a webpack override in remotion.config.ts, pass it here as well.
webpackOverride: (config) => config,
});
@@ -163,14 +167,14 @@ const inputProps = {};
const composition = await selectComposition({
serveUrl: bundled,
- id: "MyComp",
+ id: 'MyComp',
inputProps,
});
-console.log("Starting to render composition");
+console.log('Starting to render composition');
await renderMedia({
- codec: "h264",
+ codec: 'h264',
composition,
serveUrl: bundled,
outputLocation: `out/${composition.id}.mp4`,
@@ -252,6 +256,7 @@ Alpine Linux is a lightweight distribution often used in Docker. There are two k
## Changelog
+**November 6th, 2024**: Use node:22-bookworm-slim over node:20-bookworm to update to LTS and get a much smaller image.
**October 11th, 2023**: Used the node:20-bookworm, which is faster to deploy and also Debian.
**September 25th, 2023**: Recommend setting `enableMultiProcessOnLinux`.
diff --git a/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx b/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx
index a84531f208..39b76815f9 100644
--- a/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx
+++ b/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-miscellaneous-cloud-gpu-docker.png
title: Setup EC2 for Docker with GPU
sidebar_label: GPU in the cloud (Docker)
-crumb: "FAQ"
+crumb: 'FAQ'
---
Follow these steps closely to render videos on EC2 in a Docker container.
@@ -20,8 +20,11 @@ We recommend to first follow these instructions and make changes once you have a
## Setup EC2 for Docker with GPU
-<Step>1</Step> Follow the instructions for <a href="/docs/miscellaneous/cloud-gpu">GPUs on EC2</a>
-. You can skip installing Chrome, Node.js and cloning the repo to render a video.
+<Step>1</Step> Follow the instructions for <a href="/docs/miscellaneous/cloud-gpu">
+ GPUs on EC2
+</a>
+. You can skip installing Chrome, Node.js and cloning the repo to render a
+video.
<Step>2</Step> Install NVIDIA Container toolkit:
@@ -61,7 +64,9 @@ sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```
-<Step>5</Step> Create two files, <code>Dockerfile</code> and <code>entrypoint.sh</code>
+<Step>5</Step> Create two files, <code>Dockerfile</code> and <code>
+ entrypoint.sh
+</code>
. You can for example create them using the <code>nano ./file-to-create</code> command.
Use <kbd>Ctrl</kbd>
<kbd>X</kbd> to save and quit. <br />
@@ -108,12 +113,12 @@ Use the [`npx remotion gpu`](/docs/cli/gpu) command to get the output of `chrome
<Credits
contributors={[
{
- username: "UmungoBungo",
- contribution: "Workflow author",
+ username: 'UmungoBungo',
+ contribution: 'Workflow author',
},
{
- username: "kaf-lamed-beyt",
- contribution: "Writeup",
+ username: 'kaf-lamed-beyt',
+ contribution: 'Writeup',
},
]}
/>
diff --git a/packages/docs/docs/miscellaneous/linux-dependencies.mdx b/packages/docs/docs/miscellaneous/linux-dependencies.mdx
index 91dd7421e7..934e41aaa1 100644
--- a/packages/docs/docs/miscellaneous/linux-dependencies.mdx
+++ b/packages/docs/docs/miscellaneous/linux-dependencies.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-miscellaneous-linux-dependencies.png
sidebar_label: Linux Dependencies
title: Linux Dependencies
-crumb: "FAQ"
+crumb: 'FAQ'
---
If you are on Linux, Chrome Headless Shell requires some shared libraries to be installed.
@@ -38,6 +38,8 @@ RUN apt install -y \
libxfixes3 \
libxcomposite1 \
libxdamage1 \
+ libpango-1.0-0 \
+ libcairo2 \
libatk-bridge2.0-0
```
diff --git a/packages/docs/docs/studio/deploy-server.mdx b/packages/docs/docs/studio/deploy-server.mdx
index 5445094b6b..2c40efb7c2 100644
--- a/packages/docs/docs/studio/deploy-server.mdx
+++ b/packages/docs/docs/studio/deploy-server.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-studio-deploy-server.png
title: Deploy the Remotion Studio on a VPS
sidebar_label: Deploy to a VPS
-crumb: "Remotion Studio"
+crumb: 'Remotion Studio'
---
<YouTube
@@ -26,7 +26,7 @@ The following examples have been tested with the [Hello World](/templates/hello-
## Dockerizing the Remotion Studio
```docker title="Dockerfile"
-FROM node:20-bookworm
+FROM node:22-bookworm-slim
# Install Chrome dependencies
RUN apt-get update
@@ -42,6 +42,8 @@ RUN apt install -y \
libxcomposite1 \
libxdamage1 \
libatk-bridge2.0-0 \
+ libpango-1.0-0 \
+ libcairo2 \
libcups2
# Copy everything from your project to the Docker image. Adjust if needed.
diff --git a/packages/template-still/Dockerfile b/packages/template-still/Dockerfile
index 1cf5601739..e2e054aa76 100644
--- a/packages/template-still/Dockerfile
+++ b/packages/template-still/Dockerfile
@@ -1,7 +1,7 @@
# This is a dockerized version of a server that you can easily deploy somewhere.
# If you don't want server rendering, you can safely delete this file.
-FROM node:20-bookworm
+FROM node:22-bookworm-slim
RUN apt install -y \
libnss3 \