Cyberworld-builders / academy

A designated place for educational and training docs, materials and exercises. Also a place to track issues and progress and a lab for code that can be potentially used elsewere.
0 stars 0 forks source link

Demonstrate a Refactoring of Poorly-Designed Dockerfiles #20

Open jaylong255 opened 4 months ago

jaylong255 commented 4 months ago

One common mistake I see out in the wild is poorly-designed Dockerfiles. There are many developers who are either new to Docker or maybe they just never took the time to do a deep dive into the basics of what Docker does and how it works. It's easy to jam all your steps into a Dockerfile and when it works, it works.

It is important to take care when designing Dockerfiles. Make sure you are not including unnecessary files. Make sure you are layering your Dockerfiles such that the layers can be stored and re-used instead of forcing your builds to have to create redundant layers.

This will make your deployments to build faster and use fewer computing resources.

TASK: Find an example of a poorly-designed Dockerfile and clean up the layers. Include information like the time-to-build comparison between the two examples, before and after.