Reduce image size by cleaning cache upon installs from npm and apk with npm cache clean --force and the --no-cache option respectively. Since builds use Docker image cache, the NPM/APK cache is not needed.
Remove usage of apk upgrade.
I don't believe there's a need to upgrade all OS packages since you're already using the latestalpine image. The provider of the base image should be the one responsible to choose the version of the packages used inside the base (or update to the latest), while you're mostly responsible for the ones you need.
Description
Improvements
npm cache clean --force
and the--no-cache
option respectively. Since builds use Docker image cache, the NPM/APK cache is not needed.apk upgrade
.How Has This Been Tested?
Locally through Docker builds. Results below.