A detailed guide on reducing Docker image sizes for Scala applications from 722 MB to 198 MB using Nix. The approach involves using jre_minimal instead of full JDK, analyzing dependencies with jdeps to include only necessary Java modules, and optimizing Docker image construction with buildEnv to avoid file duplication. The tutorial covers common pitfalls like missing SSL modules and provides a complete working derivation for creating minimal container images.

12m read timeFrom blog.aiono.dev
Post cover image
Table of contents
First attemptMinimal Java Runtime EnvironmentsdockerTools.copyToRoot GotchasComparison with other approachesFinal derivationConclusion

Sort: