sheharyarn / cloudup.dev

Tools to jump-start development on the Cloud ☁️
https://cloudup.dev
106 stars 11 forks source link

Optimize RUN Commands Order in Dockerfile #15

Open am-nimrah opened 8 months ago

am-nimrah commented 8 months ago

The order of the RUN commands in the second stage may impact caching efficiency. Consider rearranging the commands to optimize for caching, placing less frequently changing commands earlier in the Dockerfile.

sheharyarn commented 8 months ago

I'm assuming you're talking about the Dockerfile for Elixir/Phoenix apps, but your suggestions here are still vague.

Can you clarify what you mean with clear example on how the current command order is inefficient and how it can be improved with certain changes?

am-nimrah commented 8 months ago

Consolidate copying of package and source code by COPY . ./ in the dockerfile for a more efficient build in a structured way.

sheharyarn commented 8 months ago

Can you give an example from the Dockerfile?