Skip to content

install sccache in the image #144

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

Merged
merged 3 commits into from
May 22, 2024
Merged

install sccache in the image #144

merged 3 commits into from
May 22, 2024

Conversation

cbeck88
Copy link
Contributor

@cbeck88 cbeck88 commented May 15, 2024

Hi, would you take a patch to install sccache in the image? It's pretty useful for making builds faster

cargo install sccache builds sccache from source, which is simple, but it's slower and idk if that is bad for you. We could also download pre-built packages, up to your preference

# Define the sccache version
ARG SCCACHE_VERSION=0.3.0

ENV SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz"
#SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-aarch64-unknown-linux-musl.tar.gz"

# Install prebuilt sccache based on platform
RUN wget -O sccache.tar.gz $SCCACHE_URL && \
    tar -xzf sccache.tar.gz && \
    mv sccache-v${SCCACHE_VERSION}-*-unknown-linux-musl/sccache /usr/local/bin/ && \
    chmod +x /usr/local/bin/sccache && \
    rm -rf sccache.tar.gz sccache-v${SCCACHE_VERSION}-*-unknown-linux-musl

@clux
Copy link
Owner

clux commented May 17, 2024

Hey, thanks for this. I think sccache is probably one of those tools that make a lot of sense in this image.

The tradeoff here would mostly be compile times (which are already taking an hour on GHA due to arm)), so my gut feel here is that installing via curl by grabbing the right tarball in each image build from the releases, would probably be the best thing to try. If you're able to try that out, I'd take a patch!

@cbeck88
Copy link
Contributor Author

cbeck88 commented May 19, 2024

this is passing tests for me locally, lmk if it looks okay. thanks

@clux
Copy link
Owner

clux commented May 19, 2024

Thanks a lot! This looks sensible to me. Happy to include it as is, but two questions in case they are not oversights:

@cbeck88
Copy link
Contributor Author

cbeck88 commented May 20, 2024

Sorry, that’s a mistake, will fix

Copy link
Owner

@clux clux left a comment

Choose a reason for hiding this comment

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

Thank you. Happy to send this out as is for now.
If you have some usage you could link in the future in this issue or in the README then this would be appreciated!

@clux clux merged commit f155111 into clux:main May 22, 2024
2 of 6 checks passed
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