Result

Starting from a baseline image (1710 MB) the resulting image (106 MB) is 93.80% smaller.

# Branch Image (MB) Layer Count node Binary (MB) node_modules (MB) Server (B)

0

Baseline

1710

22

116.0

20.0

2515

1

.dockerignore

1670

23

116.0

20.0

2515

2

npm ci

1640

23

116.0

9.1

2515

3

clean-modules

1630

23

116.0

6.3

2515

4

Smaller Base Image

239

20

118.0

6.2

2515

5

Multi-Stage Build

234

19

118.0

6.2

2515

6

Separate Serving Image

196

15

118.0

6.2

2515

7

Harden the Image

196

17

118.0

6.2

2515

8

Compress Node Binary

113

17

41.6

6.2

2515

9

Bundle With External Packages

113

17

41.6

6.2

2003

10

Bundle Without External Packages

106

16

41.6

0

1287240