balena-io / balena-cli

The official balena CLI tool.
Apache License 2.0
452 stars 138 forks source link

Node apps (without a Dockerfile): base image resolution takes several minutes #1830

Open pdcastro opened 4 years ago

pdcastro commented 4 years ago

"Node applications" that do not include a Dockerfile are documented at: https://www.balena.io/docs/learn/develop/dockerfile/#node-applications

The current implementation takes several minutes to "resolve" what base image to use, by first (slowly) listing all available base images, with an in-memory (non persistent) cache:

https://github.com/balena-io-modules/resin-bundle-resolve/blob/v4.3.0/src/resolvers/nodeResolver.ts#L31-L66

A proposal discussed in a call with @CameronDiver and @shaunmulligan (flowdock thread (private)) is to replace the listing of all base images with targeted requests for the "nearest Node.js LTS" version. This depends on finding a clever way of list the current LTS versions: https://nodejs.org/en/about/releases/

Another proposal, depending on investigation, is to get Docker Hub to do the image filtering with a modified query. Or at least, to list images sorted by version so that the latest versions are listed first, so we don't have to make paginated requests for all versions.

pdcastro commented 4 years ago

Connects to: #1819