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

Staged docker builds #32

Merged
merged 3 commits into from
Nov 19, 2023

Conversation

dominikandreas
Copy link
Collaborator

During the development of the home assistant addon, I had the problem that building the dockerfile took a long time to complete since it always needed to build all dependencies from scratch.

This PR splits compilation of the rust application into 3 stages:

  1. building the dependencies
  2. building the Protobuf files
  3. building the actual application source code

and adds caching support to the github workflow. Each stage / layer will then only need to be recompiled when their dependencies change, reducing the build time from almost an hour to just a few of minutes for minor code changes (In my experience, <1 minute on my home assistant pi4, <5 minutes for the workflow).

I also removed the "platform" argument in the qemu step of the workflow since it probably isn't necessary and didn't have any effect anyway (would need to be renamed to "platforms" to take effect)

Dockerfile Show resolved Hide resolved
Copy link
Owner

@DennisOSRM DennisOSRM left a comment

Choose a reason for hiding this comment

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

👍🏽

@DennisOSRM DennisOSRM merged commit 6cba2ef into DennisOSRM:main Nov 19, 2023
1 check passed
@dominikandreas dominikandreas deleted the staged_docker_builds branch November 19, 2023 21:17
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