Skip to content

Commit

Permalink
target/.stamp -> .stamp
Browse files Browse the repository at this point in the history
  • Loading branch information
miraclx committed May 2, 2023
1 parent aa38898 commit 4f8e016
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ RUN rm -rf ./target/docker-cache.tgz
RUN find ./target -type f && find /usr/local/cargo -type f
RUN CARGO_INCREMENTAL=0 cargo build --release --package mpc-recovery
# todo! prune unused artifacts (ex: now-unused deps, previous builds)
RUN mkdir -p target/.stamp \
&& find /usr/src/app/target/release -type f | sort > target/.stamp/target \
&& find /usr/local/cargo/bin -type f | sort > target/.stamp/cargo-bin \
&& find /usr/local/cargo/git/db -type f | sort > target/.stamp/cargo-git-db \
&& find /usr/local/cargo/registry/cache -type f | sort > target/.stamp/cargo-registry-cache \
&& find /usr/local/cargo/registry/index -type f | sort > target/.stamp/cargo-registry-index \
RUN mkdir -p .stamp \
&& find /usr/src/app/release -type f | sort > .stamp/target \
&& find /usr/local/cargo/bin -type f | sort > .stamp/cargo-bin \
&& find /usr/local/cargo/git/db -type f | sort > .stamp/cargo-git-db \
&& find /usr/local/cargo/registry/cache -type f | sort > .stamp/cargo-registry-cache \
&& find /usr/local/cargo/registry/index -type f | sort > .stamp/cargo-registry-index \
&& touch /usr/local/cargo/.crates.toml /usr/local/cargo/.crates2.json \
&& sha256sum /usr/local/cargo/.crates.toml > target/.stamp/cargo-crates-toml \
&& sha256sum /usr/local/cargo/.crates2.json > target/.stamp/cargo-crates2-json
&& sha256sum /usr/local/cargo/.crates.toml > .stamp/cargo-crates-toml \
&& sha256sum /usr/local/cargo/.crates2.json > .stamp/cargo-crates2-json

FROM scratch as retrieve-stamp
COPY --from=builder /usr/src/app/target/.stamp /
COPY --from=builder /usr/src/app/.stamp /

FROM scratch as export-artifacts
COPY --from=builder /usr/src/app/target /usr/src/app/target
Expand Down
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _docker-build:
docker build . --target retrieve-stamp --output $latest_stamp_stage; \
printf "\x1b[1mTesting for cache relevance...\x1b[0m" >&2; \
cached_stamp_stage=$(mktemp -d); \
tar -C $cached_stamp_stage -xzf target/docker-cache.tgz usr/src/app/target/.stamp --strip-components 5; \
tar -C $cached_stamp_stage -xzf target/docker-cache.tgz usr/src/app/.stamp --strip-components 5; \
if ! diff -qr $latest_stamp_stage $cached_stamp_stage; \
then \
echo -e "\x1b[1mcache invalidated, update required\x1b[0m" >&2; \
Expand Down

0 comments on commit 4f8e016

Please sign in to comment.