Open moltar opened 3 months ago
Just tried aws/codebuild/standard:6.0
and aws/codebuild/amazonlinux2-x86_64-standard:5.0
and it's the same behaviour across all images.
root@b247bddeaf6a:/tmp# npm -v --verbose
npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@10.2.4
npm info using node@v18.19.1
npm verb title npm
npm verb argv "--version" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/root/.npm/_logs/2024-06-03T09_10_35_370Z-
npm verb logfile /root/.npm/_logs/2024-06-03T09_10_35_370Z-debug-0.log
10.2.4
npm verb exit 0
npm info ok
root@b247bddeaf6a:/tmp# cat /root/.npm/_logs/2024-06-03T09_10_35_370Z-debug-0.log
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using npm@10.2.4
2 info using node@v18.19.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 4ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/tmp/.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:/root/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 40ms
14 timing config:load:global Completed in 40ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 52ms
17 timing npm:load:configload Completed in 52ms
18 timing config:load:flatten Completed in 2ms
19 timing npm:load:mkdirpcache Completed in 1ms
20 timing npm:load:mkdirplogs Completed in 46ms
21 verbose title npm
22 verbose argv "--version" "--loglevel" "verbose"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 2ms
25 verbose logfile logs-max:10 dir:/root/.npm/_logs/2024-06-03T09_10_35_370Z-
26 verbose logfile /root/.npm/_logs/2024-06-03T09_10_35_370Z-debug-0.log
27 timing npm:load:logFile Completed in 61ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 382ms
31 verbose exit 0
32 timing npm Completed in 386ms
33 info ok
root@b247bddeaf6a:/tmp#
Also, a weird scenario, simply running apt installs, will somehow magically speed up npm run.
Is it a filesystem warm up? Is it some background job that does some optimization?
root@ef8489a1386b:/tmp# apt-get update && apt-get install time
Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:2 https://apt.corretto.aws stable InRelease [10.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Get:6 https://apt.corretto.aws stable/main i386 Packages [4561 B]
Get:7 https://apt.corretto.aws stable/main amd64 Packages [17.9 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy/multiverse i386 Packages [134 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
Get:10 http://archive.ubuntu.com/ubuntu jammy/main i386 Packages [1324 kB]
Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
Get:12 http://archive.ubuntu.com/ubuntu jammy/universe i386 Packages [9385 kB]
Get:13 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2395 kB]
Get:14 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:15 http://archive.ubuntu.com/ubuntu jammy/restricted i386 Packages [36.7 kB]
Get:16 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
Get:17 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2129 kB]
Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1377 kB]
Get:19 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse i386 Packages [4743 B]
Get:20 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [51.1 kB]
Get:21 http://archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [878 kB]
Get:22 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [2468 kB]
Get:23 http://archive.ubuntu.com/ubuntu jammy-updates/restricted i386 Packages [46.1 kB]
Get:24 http://archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [790 kB]
Get:25 http://archive.ubuntu.com/ubuntu jammy-backports/main i386 Packages [71.2 kB]
Get:26 http://archive.ubuntu.com/ubuntu jammy-backports/universe i386 Packages [18.4 kB]
Get:27 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [31.8 kB]
Get:28 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [81.0 kB]
Get:29 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.7 kB]
Get:30 http://security.ubuntu.com/ubuntu jammy-security/multiverse i386 Packages [1338 B]
Get:31 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [752 kB]
Get:32 http://security.ubuntu.com/ubuntu jammy-security/restricted i386 Packages [44.2 kB]
Get:33 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1858 kB]
Get:34 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [584 kB]
Get:35 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1084 kB]
Fetched 46.0 MB in 3s (16.3 MB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
time
0 upgraded, 1 newly installed, 0 to remove and 20 not upgraded.
Need to get 46.7 kB of archives.
After this operation, 129 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 time amd64 1.9-0.1build2 [46.7 kB]
Fetched 46.7 kB in 0s (93.7 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78, <> line 1.)
debconf: falling back to frontend: Readline
Selecting previously unselected package time.
(Reading database ... 35233 files and directories currently installed.)
Preparing to unpack .../time_1.9-0.1build2_amd64.deb ...
Unpacking time (1.9-0.1build2) ...
Setting up time (1.9-0.1build2) ...
root@ef8489a1386b:/tmp# time npm -v --verbose
npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@10.2.4
npm info using node@v18.19.1
npm verb title npm
npm verb argv "--version" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/root/.npm/_logs/2024-06-03T09_22_31_535Z-
npm verb logfile /root/.npm/_logs/2024-06-03T09_22_31_535Z-debug-0.log
10.2.4
npm verb exit 0
npm info ok
real 0m0.241s
user 0m0.287s
sys 0m0.016s
root@ef8489a1386b:/tmp#
Running
npm
CLI for the first time on CodeBuild takes 12s seconds. And that's in 15 GB memory, 8 vCPUs.I suspect it has something to do with corepack. It silently tries to update
npm
or maybeapt-get
; I think it has a similar behaviour.But I tried disabling corepack via
corepack disable
and also setting various env options to turn off different behaviours. But nothing seems to have any effect.Any ideas?
Shouldn't npm be pre-installed by default?