Skip to content

Commit f7bc0c9

Browse files
authored
Set timestamp when prebuilding lib.rs (#526)
* Set timestamp in dummy build * Touch the new lib.rs
1 parent 83a273d commit f7bc0c9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ out
1212
arg.in
1313
Dockerfile
1414
*.wasm
15+
*.swp
1516

1617
# filter out all "hidden" files and directories
1718
# (.git, .dfx, .*ignore, etc)

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ RUN cargo install ic-cdk-optimizer --version 0.3.1
4747

4848
# Pre-build all cargo dependencies. Because cargo doesn't have a build option
4949
# to build only the dependecies, we pretend that our project is a simple, empty
50-
# `lib.rs`. Then we remove the dummy source files to make sure cargo rebuild
51-
# everything once the actual source code is COPYed (and e.g. doesn't trip on
52-
# timestamps being older)
50+
# `lib.rs`. When we COPY the actual files we make sure to `touch` lib.rs so
51+
# that cargo knows to rebuild it with the new content.
5352
COPY Cargo.lock .
5453
COPY Cargo.toml .
5554
COPY src/cubehash src/cubehash
5655
COPY src/internet_identity/Cargo.toml src/internet_identity/Cargo.toml
57-
RUN mkdir -p src/internet_identity/src && touch src/internet_identity/src/lib.rs && cargo build --target wasm32-unknown-unknown --release -j1 && rm -rf src
56+
RUN mkdir -p src/internet_identity/src \
57+
&& touch src/internet_identity/src/lib.rs \
58+
&& cargo build --target wasm32-unknown-unknown --release -j1 \
59+
&& rm -rf src
5860

5961
FROM deps as build
6062

@@ -65,6 +67,8 @@ ARG II_ENV=production
6567

6668
RUN npm ci
6769
RUN npm run build
70+
71+
RUN touch src/internet_identity/src/lib.rs
6872
RUN cargo build --target wasm32-unknown-unknown --release -j1
6973
RUN sha256sum dist/*
7074
RUN sha256sum /cargo_target/wasm32-unknown-unknown/release/internet_identity.wasm

0 commit comments

Comments
 (0)