-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Refactor Dockerfile #861
Refactor Dockerfile #861
Conversation
JuryTionasho
commented
Dec 12, 2023
- Use alpine image for build to have musl by default as needed for final image
- Use fixed version for both image and packages, that are known to work until a new version is needed (rust installer is the exception)
- Use digest when using a docker image since tags can be overwritten
- Install rust through official installer to take care of adding necessary architecture depending on the system used for building trippy (x86_64, arm, etc)
- Add whole contents of the repository in one go instead of file by file
- Run cargo build --release without architecture specified for anyone not running x86_64 to have a working trippy
1. Use alpine image for build to have musl by default as needed for final image 2. Use fixed version for both image and packages, that are known to work until a new version is needed (rust installer is the exception) 3. Use digest when using a docker image since tags can be overwritten 4. Install rust through official installer to take care of adding necessary architecture depending on the system used for building trippy (x86_64, arm, etc) 5. Add whole contents of the repository in one go instead of file by file 6. Run cargo build --release without architecture specified for anyone not running x86_64 to have a working trippy
Thank you for the PR @JuryTionasho ! I agree with the points about using fixed image versions (though digest is overkill IMHO, fully reproducible builds isn't the goal here) and with making the I don't think using I don't think it makes sense to copy in all files from the repo to the image, this includes things like Note also that the Finally, please be aware of #277 (PR #397) which forced the switch to |
After a bit more digging, I have found a way to install a specific version of rust, tho this should be on their installation page as well.
I'm not sure what you mean. Why would you want to use a debian image(rust:1.74) which has gnu by default Using alpine for the build and then installing rust adds it as musl This is besides the smaller image on the alpine counterpart, tho I don't know how much that matters since it's only the first build stage. Also, let me remind you that you are making a multi stage build and since L15 you are not getting any of the files you copied earlier because you are only copying the binary from the Your intentions were not clear to me, thus me adding the whole contents in one go to not add files one by one.
Let me do you one better. |
If what you care is size, you should also look into rust size optimizations since I was able to make quite a much smaller trippy image. |
Hi again @JuryTionasho, A bit of background and context; the Docker image was previously a The issue I linked to was that Now, interestingly, when I try your If the bug is fixed then I would prefer to revert to a WDYT?
Yes indeed, thanks for pointing that out and fixing it (doh!). |
curl=8.5.0-r0 \ | ||
build-base=0.5-r3 \ | ||
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.19/main |
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.
Why is this needed?
Thanks, i'm familiar with these. I'd like to make the |
Based on the latest update in crossterm-rs/crossterm#741 I think we can revert to using |