Skip to content

Commit

Permalink
Dockerfile: update rust version & caching (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Aug 5, 2022
1 parent e8da675 commit fe98e34
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
FROM rust:1.57-bullseye as builder
FROM rust:1.62-bullseye as builder
WORKDIR /usr/src/sdk-rust

# Cache dependencies between test runs,
# See https://blog.mgattozzi.dev/caching-rust-docker-builds/
# And https://github.com/rust-lang/cargo/issues/2644

RUN mkdir -p ./plan/src/
RUN echo "fn main() {}" > ./plan/src/main.rs
RUN echo "fn main() { println!(\"If you see this message, you may want to clean up the target directory or the Docker build cache.\") }" > ./plan/src/main.rs
COPY ./plan/Cargo.* ./plan/
RUN cd ./plan/ && cargo build

COPY . .

# This is in order to make sure `main.rs`s mtime timestamp is updated to avoid the dummy `main`
# remaining in the release binary.
# https://github.com/rust-lang/cargo/issues/9598
RUN touch ./plan/src/main.rs

RUN cd ./plan/ && cargo build --example example

FROM debian:bullseye-slim
Expand Down

0 comments on commit fe98e34

Please sign in to comment.