Skip to content
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

Add cache-from option #159

Closed
wants to merge 1 commit into from
Closed

Add cache-from option #159

wants to merge 1 commit into from

Conversation

nzwsch
Copy link

@nzwsch nzwsch commented Mar 25, 2023

Allowing the option --cache_from to the builder in this PR will reduce the time to build the Docker image.

https://lipanski.com/posts/speed-up-your-docker-builds-with-cache-from

@dhh
Copy link
Member

dhh commented Mar 28, 2023

If you're using your own host as a builder, you'll get layer caching automatically. No need to specify this cache-from. Seems like an optimization meant to be used in conjunction with some CI hosts? Have you run into a situation where using your own builder, either local or remote, didn't work with layer caching?

@nzwsch
Copy link
Author

nzwsch commented Apr 1, 2023

I ran the command locally and was able to use the cached image from the build as you suggested.
In my use case, I wanted to push the command to GitLab to build, run tests based on the image tag, and if the tests are successful, deploy with the mrsk command using the tag. However, I can work around this by doing an empty build of the image once pulled on CI. I think it would be hard to support bypassing all docker options with the mrsk command, so this PR can be closed.

@dhh dhh closed this Apr 1, 2023
@bdeak4
Copy link

bdeak4 commented May 14, 2023

Hi @nzwsch, did you manage to get cache working in CI builds?

I've tried something along the lines:

docker pull $DOCKER_IMAGE:latest
docker build -t $DOCKER_IMAGE:latest --cache-from $DOCKER_IMAGE:latest .
mrsk deploy

But mrsk does not seem to pick up cache from docker build

@nzwsch
Copy link
Author

nzwsch commented May 21, 2023

@bdeak4
DHH mentioned above that the build image should be used as a cache if an image layer exists. It is not necessary to run the build in the local environment.

docker pull $DOCKER_IMAGE:latest
mrsk deploy

Please make sure that the image tag is one that you have pulled into your mrsk config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants