Skip to content

Commit 54585cb

Browse files
committed
simplify extension
1 parent 636d71b commit 54585cb

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

packages/build/src/extensions/lightpanda.ts

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import type { BuildExtension } from "@trigger.dev/core/v3/build";
22

33
type LightpandaOpts = {
4-
arch?: "aarch64" | "x86_64";
5-
version?: "nightly";
4+
version?: "nightly" | "latest";
65
disableTelemetry?: boolean;
76
};
87

98
export const lightpanda = ({
10-
arch = "x86_64",
11-
version = "nightly",
9+
version = "latest",
1210
disableTelemetry = false,
1311
}: LightpandaOpts = {}): BuildExtension => ({
1412
name: "lightpanda",
@@ -17,28 +15,12 @@ export const lightpanda = ({
1715
return;
1816
}
1917

20-
const arch = context.targetPlatform === "linux/arm64" ? "aarch64" : "x86_64";
18+
context.logger.debug(`Adding lightpanda`, { version, disableTelemetry });
2119

22-
context.logger.debug(`Adding lightpanda`, { arch, version, disableTelemetry });
23-
24-
const instructions: string[] = [];
25-
26-
// Install required packages
27-
instructions.push(
28-
`RUN apt-get update && apt-get install --no-install-recommends -y \
29-
curl \
30-
ca-certificates \
31-
&& update-ca-certificates \
32-
&& apt-get clean && rm -rf /var/lib/apt/lists/*`
33-
);
34-
35-
// Install Lightpanda
36-
instructions.push(
37-
`RUN curl -L -f --retry 3 -o lightpanda https://github.com/lightpanda-io/browser/releases/download/${version}/lightpanda-${arch}-linux || (echo "Failed to download Lightpanda binary" && exit 1) \
38-
&& chmod a+x ./lightpanda \
39-
&& mv ./lightpanda /usr/bin/lightpanda \
40-
&& /usr/bin/lightpanda version || (echo "Downloaded binary is not functional" && exit 1)`
41-
);
20+
const instructions = [
21+
`COPY --from=lightpanda/browser:${version} /usr/bin/lightpanda /usr/local/bin/lightpanda`,
22+
`RUN /usr/local/bin/lightpanda version || (echo "lightpanda binary is not functional" && exit 1)`,
23+
] satisfies string[];
4224

4325
context.addLayer({
4426
id: "lightpanda",
@@ -47,7 +29,6 @@ export const lightpanda = ({
4729
},
4830
deploy: {
4931
env: {
50-
LIGHTPANDA_BROWSER_PATH: "/usr/bin/lightpanda",
5132
...(disableTelemetry ? { LIGHTPANDA_DISABLE_TELEMETRY: "true" } : {}),
5233
},
5334
override: true,

0 commit comments

Comments
 (0)