How do you exclude dev dependencies from the final image?
BeginnerConceptDockerfile Instructions & Builds
Answer
Use a multi-stage build: install everything and compile in a builder stage, then in the runtime stage install production deps only (npm ci --omit=dev, pip install --no-cache-dir, mvn package and copy the jar) or copy only the built output.