Open virtuman opened 6 months ago
Feel free to submit a PR. I made some Dockerfile changes today, by the way, in case that affected your build time.
Just saw this, I think my PR #2275 aims to address this issue to some extent.
Just saw this, I think my PR #2275 aims to address this issue to some extent.
yes your PR addresses it for Dockerfile.multi
but could use help to optimize the default Dockerfile
What features would you like to see added?
Docker takes too long, couple simple manipulations will drastically improve build times and utilize cached layers, to avoid entire image rebuild on each run. You can see screenshots below, to notice build time differences
More details
something like this would result in a quicker build, given that you use runner that has docker cache, or pull :latest and use as cache. And minimize number of RUN commands, so that it doesn't persist layer after each command
here're the differences:
all steps that i marked, will re-use cached layers, and only app build will re-run on every rebuild of the app
this way, image build will go to seconds, if you use runners that have perstitent docker or use --pull in docker build command, to re-use cached layers (that will add few extra seconds to pull last built image as cache from docker registry)
Below is a working version of Dockerfile that I use it myself
Which components are impacted by your request?
No response
Pictures
Initial Build - before caching or if package-json files not changed
Consequent rebuild without code changes
Code changed in client only
Code of Conduct