[refactor] Utilize multistage builds to improve caching and compatibility #271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why is this pull request needed?
Gives us smaller images, and reduces the risk for adding files which should not be included
What does this pull request change?
The main changes here are;
For the API, I moved the tests outside the
src
folder. That way, we do not include the tests in the finished image. Since we use multi-stage builds, we can install the necessary compilers for running on ARM. The compilers are not part of the "production" image, and we don't need to worry about them taking up more space in the image layers.I also created a user (similar to what's done in
nginx
) so that we can run the tests without running the container as root.When only installing the necessary packages, I noticed that
click
is not explicitly defined, so it wasn't included insite-packages
. By explicitly listing it inpyproject.toml
, that issue is resolved.