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

Add sccache #127

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ARG CARGO_ABOUT_VERSION=0.2.3
ARG CARGO_DENY_VERSION=0.8.5
ARG ZLIB_VERSION=1.2.11
ARG POSTGRESQL_VERSION=11.11

ARG SCCACHE_VERSION=0.2.15
# Make sure we have basic dev tools for building C libraries. Our goal here is
# to support the musl-libc builds and Cargo builds needed for a large selection
# of the most popular crates.
Expand Down Expand Up @@ -61,6 +61,10 @@ RUN apt-get update && \
tar xf mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz && \
mv mdbook /usr/local/bin/ && \
rm -f mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz && \
curl -fLO https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz && \
tar xf sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz && \
mv sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl/sccache /usr/local/bin/ && chmod +x /usr/local/bin/sccache && \
rm -rf sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl && \
curl -fLO https://github.com/EmbarkStudios/cargo-about/releases/download/$CARGO_ABOUT_VERSION/cargo-about-$CARGO_ABOUT_VERSION-x86_64-unknown-linux-musl.tar.gz && \
tar xf cargo-about-$CARGO_ABOUT_VERSION-x86_64-unknown-linux-musl.tar.gz && \
mv cargo-about-$CARGO_ABOUT_VERSION-x86_64-unknown-linux-musl/cargo-about /usr/local/bin/ && \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ You may be able to speed up build performance by adding the following `-v` comma
```txt
-v cargo-git:/home/rust/.cargo/git
-v cargo-registry:/home/rust/.cargo/registry
-v target:/home/rust/src/target
-v sccache:/home/rust/.cache/sccache
```

You will also need to fix the permissions on the mounted volumes:

```sh
rust-musl-builder sudo chown -R rust:rust \
/home/rust/.cargo/git /home/rust/.cargo/registry /home/rust/src/target
/home/rust/.cargo/git /home/rust/.cargo/registry /home/rust/.cache/sccache
```

## How it works
Expand Down
2 changes: 1 addition & 1 deletion cargo-config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build]
# Target musl-libc by default when running Cargo.
target = "x86_64-unknown-linux-musl"

rustc-wrapper = "sccache"
[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc"