11import type { BuildExtension } from "@trigger.dev/core/v3/build" ;
22
3- const NAME = "LightpandaExtension" ;
4-
53type LightpandaOpts = {
64 arch ?: "aarch64" | "x86_64" ;
75 version ?: "nightly" ;
@@ -13,31 +11,28 @@ export const lightpanda = ({
1311 version = "nightly" ,
1412 disableTelemetry = false ,
1513} : LightpandaOpts = { } ) : BuildExtension => ( {
16- name : NAME ,
14+ name : "lightpanda" ,
1715 onBuildComplete : async ( context ) => {
18- context . logger . progress ( `Running ${ NAME } on ${ context . target } env for arch ${ arch } ` ) ;
19- context . logger . progress ( `version: ${ version } ` ) ;
20-
2116 if ( context . target === "dev" ) {
2217 return ;
2318 }
2419
25- const instructions : string [ ] = [ ] ;
20+ const arch = context . targetPlatform === "linux/arm64" ? "aarch64" : "x86_64" ;
2621
27- if ( disableTelemetry ) {
28- instructions . push ( "RUN export LIGHTPANDA_DISABLE_TELEMETRY=true" ) ;
29- }
22+ context . logger . debug ( `Adding lightpanda` , { arch , version , disableTelemetry } ) ;
23+
24+ const instructions : string [ ] = [ ] ;
3025
31- /* Update / install required packages */
26+ // Install required packages
3227 instructions . push (
3328 `RUN apt-get update && apt-get install --no-install-recommends -y \
34- curl \
35- ca-certificates \
29+ curl \
30+ ca-certificates \
3631 && update-ca-certificates \
3732 && apt-get clean && rm -rf /var/lib/apt/lists/*`
3833 ) ;
3934
40- /* Install Lightpanda */
35+ // Install Lightpanda
4136 instructions . push (
4237 `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) \
4338 && chmod a+x ./lightpanda \
@@ -53,6 +48,7 @@ export const lightpanda = ({
5348 deploy : {
5449 env : {
5550 LIGHTPANDA_BROWSER_PATH : "/usr/bin/lightpanda" ,
51+ ...( disableTelemetry ? { LIGHTPANDA_DISABLE_TELEMETRY : "true" } : { } ) ,
5652 } ,
5753 override : true ,
5854 } ,
0 commit comments