Optimize Docker builds

Apache 2.0

Apply build optimization best practices to Dockerfiles. This includes combining RUN instructions to reduce layers and adding cleanup commands to reduce image size.

org.openrewrite.docker.DockerBuildOptimization
mod run . --recipe=org.openrewrite.docker.DockerBuildOptimization

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Combine consecutive RUN instructions
  2. Add apt-get cleanup