cloudup.dev icon indicating copy to clipboard operation
cloudup.dev copied to clipboard

Optimize RUN Commands Order in Dockerfile

Open am-nimrah opened this issue 1 year ago • 5 comments

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.

am-nimrah avatar Jan 12 '24 11:01 am-nimrah

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?

sheharyarn avatar Jan 15 '24 19:01 sheharyarn

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

am-nimrah avatar Jan 15 '24 19:01 am-nimrah

Can you give an example from the Dockerfile?

sheharyarn avatar Jan 15 '24 20:01 sheharyarn