mozilla-services / contile

This is the back-end server for the Mozilla Tile Service (MTS)
https://mozilla-services.github.io/contile/
Mozilla Public License 2.0
19 stars 2 forks source link

[DISCO-2394] chore: Use cargo chef to speed up docker build #561

Closed ncloudioj closed 1 year ago

ncloudioj commented 1 year ago

References

JIRA: DISCO-2394 GitHub: N/A

Description

Use Cargo Chef to speed up docker build. Empirical results suggest a 50% reduction in docker build duration.

PR Review Checklist

Put an x in the boxes that apply

pjenvey commented 1 year ago

Seems like it's very hit or miss but when it works it works well.

It's odd that the last couple of builds it did cache hit the initial docker steps, but for whatever reason not the cargo chef cook step where it really counts.

Wanna just merge it and we'll monitor it over time (probably want to add a [do not deploy])?

ncloudioj commented 1 year ago

Thanks, Phil! Indeed, it works really well for local builds, and vastly cuts the build time so long as the dependencies remain unchanged, so I think that's already a win. However it's quite hit or miss in CI, I guess it has to do with how CircleCI's container caching layer works. I've tried to overcome that but still couldn't get it to leverage the dependency cache all the time. The bottom line is that it doesn't regress the build time in CI 🤷‍♂️.

Wanna just merge it and we'll monitor it over time (probably want to add a [do not deploy])?

Yup, let's give it a spin and see how useful it can be in practice. re: [do not deploy], we haven't fully set up the CD bit in Jenkins, so it will just publish docker images without deploying :)