Ability to "trim" certain "default dependencies" in build image?

It is like this in build log,

7:34:06 PM: Starting build script
7:34:06 PM: Installing dependencies
7:34:06 PM: Python version set to 2.7
7:34:07 PM: Started restoring cached node version
7:34:09 PM: Finished restoring cached node version
7:34:10 PM: v12.18.0 is already installed.
7:34:10 PM: Now using node v12.18.0 (npm v6.14.4)
7:34:10 PM: Started restoring cached build plugins
7:34:10 PM: Finished restoring cached build plugins
7:34:11 PM: Attempting ruby version 2.7.1, read from environment
7:34:12 PM: Using ruby version 2.7.1
7:34:12 PM: Using PHP version 5.6
7:34:12 PM: Started restoring cached go cache
7:34:12 PM: Finished restoring cached go cache
7:34:12 PM: go version go1.14.4 linux/amd64
7:34:12 PM: go version go1.14.4 linux/amd64
7:34:12 PM: Installing missing commands
7:34:12 PM: Verify run directory

It takes 6 seconds to install all the dependencies, however I need only node.js, but no python, ruby, php and go. The installation of node.js takes only 3 seconds. So, it can be 3 seconds faster if there is no installation of python, ruby, php and go.

For this site, It takes only 4 seconds from Netlify Build to Netlify Build Complete, and 4 seconds to prepare the repo.

7:34:14 PM: ────────────────────────────────────────────────────────────────
7:34:14 PM:   Netlify Build                                                 
7:34:14 PM: ────────────────────────────────────────────────────────────────
7:34:18 PM: (build.command completed in 3.9s)
7:34:18 PM: ​
7:34:18 PM: ────────────────────────────────────────────────────────────────
7:34:18 PM:   Netlify Build Complete                                        
7:34:18 PM: ────────────────────────────────────────────────────────────────
7:34:18 PM: ​
7:34:18 PM: (Netlify Build completed in 3.9s)
7:34:02 PM: Starting to prepare the repo for build
7:34:02 PM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
7:34:05 PM: Preparing Git Reference refs/heads/master
7:34:06 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
7:34:06 PM: Starting build script

However the whole build process takes about 20 seconds, which means it kind of wastes nearly half of build time for things I don’t need. We both, netlify and I, esp. netlify since I am currently on starter, have to pay for it.

What I am suggesting is, users should be above the trim the build process, either by some ENVs or commands, or custom build images (for me I would like to test for node:alpine and hayd/deno:alpine).

2 Likes

Great suggestion, @yw662 ! We have an open feature request on this and we have been making things more modular over the past year, but work remains to be done for sure. I’ve added your voice to that feature request.

Our optimizations today focus on saving minutes rather than seconds, but we do understand that you’d rather not waste even seconds.