Skip to content

Commit 531614a

Browse files
committed
fix: lightpanda extension instructions
1 parent b593088 commit 531614a

File tree

2 files changed

+67
-8
lines changed

2 files changed

+67
-8
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: "Lightpanda"
3+
sidebarTitle: "lightpanda"
4+
description: "Use the lightpanda build extension to be able to use Lightpanda Browser in your project"
5+
---
6+
7+
<ScrapingWarning />
8+
9+
To use Lightpanda in your project, add these build settings to your `trigger.config.ts` file:
10+
11+
```ts trigger.config.ts
12+
import { defineConfig } from "@trigger.dev/sdk/v3";
13+
import { lightpanda } from "@trigger.dev/build/extensions/lightpanda";
14+
15+
export default defineConfig({
16+
project: "<project ref>",
17+
// Your other config settings...
18+
build: {
19+
extensions: [lightpanda()],
20+
},
21+
});
22+
```
23+
24+
And add the following environment variable in your Trigger.dev dashboard on the Environment Variables page:
25+
26+
```bash
27+
LIGHTPANDA_BROWSER_PATH: "/usr/bin/lightpanda",
28+
```
29+
30+
Follow [this example](/guides/examples/lightpanda) to get setup with Trigger.dev and Lightpanda in your project.

packages/build/src/extensions/lightpanda.ts

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

3+
const NAME = 'LightpandaExtension'
4+
35
type LightpandaOpts = {
46
arch?: 'aarch64' | 'x86_64'
57
version?: 'nightly'
8+
disableTelemetry?: boolean
69
}
710

8-
export const lightpanda = ({ arch = 'x86_64', version = 'nightly' }: LightpandaOpts = {}): BuildExtension => ({
9-
name: "LightpandaExtension",
11+
export const lightpanda = ({ arch = 'x86_64', version = 'nightly', disableTelemetry = false }: LightpandaOpts = {}): BuildExtension => ({
12+
name: NAME,
1013
onBuildComplete: async (context) => {
14+
context.logger.progress(`Running ${NAME} on ${context.target} env for arch ${arch}`);
15+
context.logger.progress(`version: ${version}`);
16+
1117
if (context.target === "dev") {
1218
return
1319
}
1420

15-
context.logger.debug(lightpanda.name);
21+
const instructions: string[] = []
22+
23+
if (disableTelemetry) {
24+
instructions.push('RUN export LIGHTPANDA_DISABLE_TELEMETRY=true')
25+
}
26+
27+
/* Update / install required packages */
28+
instructions.push(
29+
`RUN apt-get update && apt-get install --no-install-recommends -y \
30+
curl \
31+
ca-certificates \
32+
&& update-ca-certificates \
33+
&& apt-get clean && rm -rf /var/lib/apt/lists/*`,
34+
)
35+
36+
/* Install Lightpanda */
37+
instructions.push(
38+
`RUN curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/${version}/lightpanda-${arch}-linux`,
39+
'RUN chmod a+x ./lightpanda',
40+
'RUN mv ./lightpanda /usr/bin/lightpanda',
41+
)
42+
1643
context.addLayer({
1744
id: "lightpanda",
1845
image: {
19-
instructions: [
20-
`RUN apt-get update && apt-get install curl -y \ &&
21-
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/${version}/lightpanda-${arch}-linux \ &&
22-
chmod a+x ./lightpanda`,
23-
],
46+
instructions,
47+
},
48+
deploy: {
49+
env: {
50+
LIGHTPANDA_BROWSER_PATH: "/usr/bin/lightpanda",
51+
},
52+
override: true,
2453
},
2554
})
2655
},

0 commit comments

Comments
 (0)