Until we can implement proper multi-buildpack support, injecting the nodejs buildpack before the primary application language buildpack (but after the apt buildpack, if there is one) would enable applications with statically generated frontend assets at buildtime. This could possibly be generalized to injecting any of the builder-supported buildpacks.
Description
Details
Title | Reference | Author | Source Branch | Dest Branch | |
---|---|---|---|---|---|
builds-builder: bump to 0.0.76-20231012133802-65e5029c | repos/cloud/toolforge/toolforge-deploy!116 | sstefanova | bump_builds-builder | main | |
inject-buildpacks: inject nodejs buildpack | repos/cloud/toolforge/builds-builder!15 | sstefanova | slavina/inject-nodejs | main |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | LucasWerkmeister | T320140 Migrate wd-shex-infer from Toolforge GridEngine to Toolforge Kubernetes | |||
Resolved | matmarex | T319707 Migrate dtcheck from Toolforge GridEngine to Toolforge Kubernetes | |||
Resolved | Legoktm | T320062 Migrate steve-adder from Toolforge GridEngine to Toolforge Kubernetes | |||
Resolved | Legoktm | T320011 Migrate rfa-voting-history from Toolforge GridEngine to Toolforge Kubernetes | |||
Open | dcaro | T194332 [Epic,builds-api,components-api,webservice,jobs-api] Make Toolforge a proper platform as a service with push-to-deploy and build packs | |||
Duplicate | Feature | None | T305780 toolforge-jobs – wikihistory needs a container with both php7 and mono | ||
Resolved | Slst2020 | T325799 [tbs] User story - I can use multiple language stacks for my application | |||
Resolved | Slst2020 | T346635 [tbs][builder] Inject nodejs buildpack |
Event Timeline
I created a dummy Vue + Flask project that uses nodejs to build the Vue static assets at buildtime. This generates a ./dist folder from which the assets are served by the Flask application.
- It injects the nodejs buildpack by prepending it to group.toml
- The Python buildpack is selected when the detect lifecycle step is run
- The execution order is nodejs first, then python
- The nodejs buildpack takes care of installing npm, i.e. it's not necessary to specify the npm buildpack separately.
- The nodejs buildpack executes the build script specified in package.json
- The image builds and runs as expected when built with either pack or the tekton pipeline
The project repo is here: https://github.com/blancadesal/flask-vue I will migrate it to Gitlab when finished.
I've tested with both, and in this particular case, it doesn't seem to matter in which order the nodejs and python buildpacks are executed. However, the Heroku docs say...
The buildpack for the primary language of your app should always be the last buildpack in the list. This ensures that defaults for that primary language are applied instead of those for another language, and allows Heroku to correctly detect the primary language of your app.
So just to be cautious, we will be injecting the nodejs buildpack before other language packs. In the future, it may become possible to specify the ordering by file, the CLI, or both.
sstefanova opened https://gitlab.wikimedia.org/repos/cloud/toolforge/builds-builder/-/merge_requests/15
inject-buildpacks: inject nodejs buildpack
sstefanova merged https://gitlab.wikimedia.org/repos/cloud/toolforge/builds-builder/-/merge_requests/15
inject-buildpacks: inject nodejs buildpack
sstefanova opened https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/116
builds-builder: bump to 0.0.76-20231012133802-65e5029c
sstefanova merged https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/116
builds-builder: bump to 0.0.76-20231012133802-65e5029c