-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Think about multistage docker build #1096
Comments
Is that a problem? If you change which packages your project uses, you want docker to install those changes, right? If you have the previous docker image pulled then it should only run subsequent layers from the |
HI, |
I feel like the following lines are not needed in the second layer:
Is there a specific reason why you added these lines twice? If you remove these, shouldn't it give the intended behavior, by only one time installing the packages (in the first layer)? The second layer will still be invalidated after an |
Hi, the first renv::restore() in the base image sets up the foundation by installing all the dependencies, which takes a long time (~1hour in this case). Once this lengthy step is done, it is cached. Then, during development or adjustments (for example, when updating your golem package to version 2), the second renv::restore() in the final Dockerfile allows you to take advantage of this cache. This step will be much faster because it doesn’t reinstall everything from scratch. It only adjusts the environment by installing any missing packages or applying necessary updates. This way, you can efficiently iterate on just step 2 without having to restart the entire restore process each time. In summary, this two-step process allows for continuous deployment of the app while making adjustments, without wasting too much time. |
today, the
add_dockerfile_with_renv
fonction create 2 Dockerfile tu be able to reuse the renv cache from the first image, in se second one.like this :
we can set instead an unique Dockerfile with multistage :
it works, but as far as i know if you change your renv.lock.prod fie it's not possible to only rerun final.
I have tried --target, --cache-from .. without succes.
some other people have the same need as us , see in python here :
https://pythonspeed.com/articles/faster-multi-stage-builds/
but the solution is not clean at all.
so I think that we will keed the actual solution,
if anyone else wants to try looking, I'd be happy to since I have no experience with docker multistage
https://stackoverflow.com/questions/52697948/artifact-caching-for-multistage-docker-builds
The text was updated successfully, but these errors were encountered: