Skip to content

Commit

Permalink
restore sccache mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
aradwann committed Nov 17, 2024
1 parent 2e75a7c commit e3ee24e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,22 @@ jobs:
# https://docs.warpbuild.com/cache/docker-layer-caching#step-1-set-up-docker-buildx-action
driver-opts: |
network=host
- name: Cache sccache
uses: actions/cache@v4
with:
path: sccache-cache
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}

- name: Inject sccache-cache into Docker
uses: reproducible-containers/buildkit-cache-dance@v3
with:
cache-map: |
{
"sccache-cache": "/var/cache/sccache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Log into GitHub container registry
uses: docker/login-action@v3
with:
Expand Down
6 changes: 5 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES chef-cook --releas

COPY . .

RUN just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --release --bin restate-server && \
# Mount the sccache directory as a cache to leverage sccache during build
# Caching layer if nothing has changed
# Use sccache during the main build
RUN --mount=type=cache,target=/var/cache/sccache \
just arch=$TARGETARCH libc=gnu features=$RESTATE_FEATURES build --release --bin restate-server && \
just notice-file && \
mv target/$(just arch=$TARGETARCH libc=gnu print-target)/release/restate-server target/restate-server

Expand Down

0 comments on commit e3ee24e

Please sign in to comment.