Reputation: 41
I am using buildpacks to build a container image of node js application.
the default entrypoint is cnb/process/web that will execute npm start.
I need to change the cmd & arguments from npm start to node {file.js}
Here's the command that I used to build image
pack build --builder gcr.io/buildpacks/builder:v1 {image-name}
is there any way to change the container entrypoint of the buildpack image? Thanks in Advance!
Upvotes: 1
Views: 1172
Reputation: 14429
There's another neat option, if you use nodejs buildpacks. The docs state to add BP_LAUNCHPOINT
as a --env
parameter like this:
pack build --builder gcr.io/buildpacks/builder:v1 --env BP_LAUNCHPOINT="file.js" {image-name}
When running the image as a container, it will start with the command node file.js
, where file.js
lies within the workspace
directory in the containers root.
In my case I had a Nuxt 3 build app, where my launchpoint is this: --env BP_LAUNCHPOINT=".output/server/index.mjs"
and thus uses node
to start the file workspace/.output/server/index.mjs
inside the root of the container.
Upvotes: 0
Reputation: 10318
Some buildpacks support a Procfile
, which allows you to configure the process used to launch the image like this:
web: npm start
For a more buildpacks-native approach see the documentation on launch processes. https://buildpacks.io/docs/app-developer-guide/run-an-app/
Upvotes: 1