-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
[build] add new dockerfiles for building from source #244
base: main
Are you sure you want to change the base?
Conversation
77655e0
to
488e545
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick to cache the cargo dependencies! Left some remarks on the Ubuntu file that mostly also apply to the Alpine file 👍
By The Way, I recommend using LukeMathWalker/cargo-chef to cache the compilation of dependencies. I created this pr (mattfbacon/typst-bot#23) for another rust project, which you can use along with the official documentation. Sorry, I didn't read this pr fully — maybe cargo chef should be in a new pr. |
@Tokarak Reading the Benefits of cargo-chef, the main benefit for using cargo chef seems to be when you are using workspaces. As redlib doesn't use those (and there is only one cargo.toml file), just using @master-hax's implementation here should be fine. @master-hax Note that docker layer caching also requires extra configuration in the workflows, see https://docs.docker.com/build/ci/github-actions/cache/ |
@pimlie |
@Tokarak It also means you have to fully trust the maintainers of cargo chef and their release process. Have you met them in person? |
@Tokarak says:
as i have mentioned, a similar optimization was merged a year ago. also as @pimlie pointed it, using if we prefer to use |
i think all the comments have been resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after these 2 small changes
This might be known already, but please note that docker layer caching of github actions also requires additional configuration in the github action workflow. Without that addtional config the layers won't ever be cached, see https://docs.docker.com/build/ci/github-actions/cache/
@sigaloid do you think this looks good to merge? |
I think this looks good. I just switched to openssl via native-tls in a96bebb. What impacts will this have on your dockerfiles, since we no longer use 100% rust-native dependencies? ARM builds are currently broken (#326) so if we could replace our builds with this, provided it still works, that would be fantastic. PS: I have very little knowledge of cross-building especially for other architectures, and the native dependencies only make it worse. So please bear with me :) |
Co-authored-by: Pim <[email protected]>
Co-authored-by: Pim <[email protected]>
aa65e78
to
25b527e
Compare
rebased the PR branch for testing |
both dockerfiles seem to work fine on both of my |
bump cc @sigaloid can we move forward with this pull request? |
description
this PR adds 2 new dockerfiles that allow users & developers to build containers from source in reference to previous discussion, restoring functionality that was lost in #59. one issue i see people facing is that doing a docker build against a specific branch or commit unexpectedly ignores that and uses the latest release.
the original dockerfiles were:
they were all basically the same alpine build but used emulation to support different architectures. however we can now use the built in multi-arch support from docker. this still uses emulation but it is simpler and no longer needs specific handling in the dockerfile.
i condensed all three of those down to
Dockerfile.alpine
with small improvements & added a brand new ubuntu basedDockerfile.ubuntu
.i hope that we can use these to replace the current no-op dockerfile in a future PR. i have an example of releasing multi-arch builds with cross-compilation here.
usage examples:
local docker build:
local buildx build (enables cross-compilation and multi-arch containers):
compose file from remote source:
compose file from local source (best for development):