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 a cache layer to Docker #594

Merged
merged 3 commits into from
Sep 20, 2023
Merged

Conversation

mdashti
Copy link
Contributor

@mdashti mdashti commented Sep 20, 2023

This PR adds a cache later to Docker using cargo-chef. This change has a noticeable improvement in the turnaround time if someone is using Docker in their development cycle.

@levkk
Copy link
Contributor

levkk commented Sep 20, 2023

Not too familiar with cargo chef. Is it ok to include this in the production image? If not, we can always create a Dockerfile.dev.

Dockerfile.dev Outdated
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want a debug build here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Done.

@mdashti
Copy link
Contributor Author

mdashti commented Sep 20, 2023

@levkk cargo chef is definitely the accepted docker cache layer, but I'm also not sure about its production grade. From their repo:

cargo-chef was initially developed for the deployment chapter of [Zero to Production In Rust](https://zero2prod.com/), a hands-on introduction to backend development using the Rust programming language.

Which might mean initially was not meant to be for production, but it is now.

Anyways, your suggestion makes sense. Thanks.

@mdashti mdashti requested a review from levkk September 20, 2023 17:23
Copy link
Contributor

@levkk levkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@levkk levkk merged commit df8aa88 into postgresml:main Sep 20, 2023
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.

2 participants