Customize how your project is built and deployed to Trigger.dev with your own custom build extensions
trigger.config.ts file, with a required name and optional build hook functions. Here’s a simple example of a build extension that just logs a message when the build starts:
BuildExtension type from the @trigger.dev/build package:
@trigger.dev/build package to your devDependencies before the below
code will work. Make sure it’s version matches that of the installed @trigger.dev/sdk package.BuildContext object as an argument.
onBuildStart hook. Here’s an example of adding a custom esbuild plugin:
BuildContext.target property to determine if the build is for dev or deploy:
BuildContext object and a BuildManifest object as arguments. This is where you can add in one or more BuildLayer’s to the context.
addLayer.
dev or deploy, matching the CLI command name that is being run.
dev or deploy.pkgs property of the image object.debug logging when running either dev or deploy:
--dry-run flag on the deploy command, which will bundle your project and generate the Containerfile (e.g. the Dockerfile) without actually deploying it. This can help you see what the final image will look like and debug any issues with the build process.