Skip to content

Commit 6b6397a

Browse files
committed
docker: fix stale build and copy build.rs in dep-warming layer
1 parent c8f89f0 commit 6b6397a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Dockerfile.alpine

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ RUN apk add --no-cache musl-dev
1111
WORKDIR /redlib
1212

1313
# download (most) dependencies in their own layer
14-
COPY Cargo.lock Cargo.toml ./
14+
COPY Cargo.lock Cargo.toml build.rs ./
1515
RUN mkdir src && echo "fn main() { panic!(\"why am i running?\") }" > src/main.rs
1616
RUN cargo build --release --locked --bin redlib
1717
RUN rm ./src/main.rs && rmdir ./src
1818

1919
# copy the source and build the redlib binary
2020
COPY . ./
21-
RUN cargo build --release --locked --bin redlib
21+
RUN touch src/main.rs && cargo build --release --locked --bin redlib
2222
RUN echo "finished building redlib!"
2323

2424
########################

Dockerfile.ubuntu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ FROM rust:${RUST_BUILDER_VERSION} AS builder
1010
WORKDIR /redlib
1111

1212
# download (most) dependencies in their own layer
13-
COPY Cargo.lock Cargo.toml ./
13+
COPY Cargo.lock Cargo.toml build.rs ./
1414
RUN mkdir src && echo "fn main() { panic!(\"why am i running?\") }" > src/main.rs
1515
RUN cargo build --release --locked --bin redlib
1616
RUN rm ./src/main.rs && rmdir ./src
1717

1818
# copy the source and build the redlib binary
1919
COPY . ./
20-
RUN cargo build --release --locked --bin redlib
20+
RUN touch src/main.rs && cargo build --release --locked --bin redlib
2121
RUN echo "finished building redlib!"
2222

2323
########################

0 commit comments

Comments
 (0)