Docker build failing to use vendor cache #451
Replies: 4 comments 1 reply
-
Looking at your build in github i do notice /opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle config --local path /home/runner/work/1v1Me-API/1v1Me-API/vendor/bundle before bundle install so maybe I am just copying nothing over? |
Beta Was this translation helpful? Give feedback.
-
I think there is simply no way to use a GitHub action inside a Docker image. Maybe you could use some Docker-level step caching instead if the first part of your Dockerfile doesn't change often? Or even build your image based on another image which already did the bundle install and is only rebuilt when there is a change to Gemfile.lock? |
Beta Was this translation helpful? Give feedback.
-
I had the same concerns last night, there no guarantee the libc ruby gems that I copy from the action operating system could match my base image os. I do agree this may be the wrong way to go about it. I am going to try buildx driver to do layer caching to see if that helps. Another option is copying out the vendor from the container and putting that into cache then mounting it back on a subsequent run. Later not idea but I was under the impression layer caching wouldn't work with bundle install but going to give it another shot. |
Beta Was this translation helpful? Give feedback.
-
Okay figured out a solution. Definitely looking in the wrong place. For some reason I didn't think docker caching would understand the gemlock file changing.
This did the trick. Got the total build time down to a minute. |
Beta Was this translation helpful? Give feedback.
-
Hi! So this is probably me issue but tried a few things to speed up my docker build in github actions as bundle is taking a majority of the time. 6 mins ! I am sure this will be helpful to others as I scoured the internet looking. I figured docker just didn't have the cache so the last thing I landed on was trying to copy it to /vender/bundle but still doesn't seem to use it.
Docker File
GitHub Action (Snippet)
I figure this prob not an issue with this library but any help be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions