Skip to content

Commit 980bd49

Browse files
authored
Merge pull request #6485 from remotion-dev/amazon-linux-2023-build
`@remotion/renderer`: Add Amazon Linux 2023 x64 binary
2 parents 28e5f19 + aaa8011 commit 980bd49

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

packages/renderer/src/browser/BrowserFetcher.ts

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {ChromeMode} from '../options/chrome-mode';
2929
import type {DownloadBrowserProgressFn} from '../options/on-browser-download';
3030
import {
3131
getChromeDownloadUrl,
32+
isAmazonLinux2023,
3233
logDownloadUrl,
3334
type Platform,
3435
TESTED_VERSION,
@@ -183,22 +184,37 @@ export const downloadBrowser = async ({
183184
abortSignal: new AbortController().signal,
184185
});
185186
await extractZip(archivePath, {dir: outputPath});
186-
const chromePath = path.join(outputPath, 'chrome-linux', 'chrome');
187-
const chromeHeadlessShellPath = path.join(
188-
outputPath,
189-
'chrome-linux',
190-
'chrome-headless-shell',
191-
);
192-
if (fs.existsSync(chromePath)) {
193-
fs.renameSync(chromePath, chromeHeadlessShellPath);
194-
}
195187

196-
const chromeLinuxFolder = path.join(outputPath, 'chrome-linux');
197-
if (fs.existsSync(chromeLinuxFolder)) {
198-
fs.renameSync(
199-
chromeLinuxFolder,
200-
path.join(outputPath, 'chrome-headless-shell-linux-arm64'),
201-
);
188+
const possibleSubdirs = [
189+
'chrome-linux',
190+
'chrome-headless-shell-linux64',
191+
'chromium-headless-shell-amazon-linux2023-arm64',
192+
'chromium-headless-shell-amazon-linux2023-x64',
193+
];
194+
195+
for (const subdir of possibleSubdirs) {
196+
const chromeLinuxFolder = path.join(outputPath, subdir);
197+
const chromePath = path.join(chromeLinuxFolder, 'chrome');
198+
199+
if (fs.existsSync(chromePath)) {
200+
const chromeHeadlessShellPath = path.join(
201+
chromeLinuxFolder,
202+
'chrome-headless-shell',
203+
);
204+
205+
fs.renameSync(chromePath, chromeHeadlessShellPath);
206+
}
207+
208+
if (fs.existsSync(chromeLinuxFolder)) {
209+
const targetFolder = path.join(
210+
outputPath,
211+
'chrome-headless-shell-' + platform,
212+
);
213+
214+
if (chromeLinuxFolder !== targetFolder) {
215+
fs.renameSync(chromeLinuxFolder, targetFolder);
216+
}
217+
}
202218
}
203219
} catch (err) {
204220
return Promise.reject(err);
@@ -248,7 +264,7 @@ const getExecutablePath = (chromeMode: ChromeMode) => {
248264
`chrome-headless-shell-${platform}`,
249265
platform === 'win64'
250266
? 'chrome-headless-shell.exe'
251-
: platform === 'linux-arm64'
267+
: platform === 'linux-arm64' || isAmazonLinux2023()
252268
? 'headless_shell'
253269
: 'chrome-headless-shell',
254270
);

packages/renderer/src/browser/get-chrome-download-url.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type Platform =
1616
| 'mac-arm64'
1717
| 'win64';
1818

19-
const isAmazonLinux2023 = (): boolean => {
19+
export const isAmazonLinux2023 = (): boolean => {
2020
if (os.platform() !== 'linux') {
2121
return false;
2222
}
@@ -129,6 +129,12 @@ export function getChromeDownloadUrl({
129129
}
130130

131131
if (chromeMode === 'headless-shell') {
132+
// Amazon Linux 2023 needs a special build.
133+
// This binary is compatible with older glibc (no 2.35 requirement).
134+
if (isAmazonLinux2023() && platform === 'linux64' && !version) {
135+
return `https://remotion.media/chromium-headless-shell-amazon-linux-x64-144.0.7559.20.zip`;
136+
}
137+
132138
if (platform === 'linux64' && version === null) {
133139
if (canUseRemotionMediaBinaries()) {
134140
return `https://remotion.media/chromium-headless-shell-linux-x64-${TESTED_VERSION}.zip?clearcache`;

0 commit comments

Comments
 (0)