hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Optimise container builds #202

Closed MikeTheCanuck closed 4 years ago

MikeTheCanuck commented 6 years ago

Caught this comment on reddit:

If you haven't caught onto this behaviour yet, Docker is clever enough to only download those layers of the image which are not present, so if an image is rebuilt several times, assuming some of the earlier steps in the Dockerfile are left unchanged and not re-run (i.e. the cached results are used), only those layers that are newly built will be pushed to and/or pulled from the registry.

We ought to take a walk through the Dockerfiles and make sure that the least volatile steps are always up front - proposed benefit being, the load time from ECR to ECS should be shorter.

znmeb commented 6 years ago

The images I built were done with knowledge of this fact - I should probably review them and make sure that's still the case. Are we tracking the base images (Debian, Python for most of them) and rebuilding whenever they change?

BrianHGrant commented 6 years ago

I also worked under this assumption. That said someone else's eyes may see opportunities to improve.