Skip to content

Commit

Permalink
Add Dockerfile (foresterre#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Oct 5, 2022
1 parent 4632e07 commit 156ad5f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.github/
/target/
/book/
/tests/
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM lukemathwalker/cargo-chef:latest-rust-latest AS chef
WORKDIR app

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --verbose --locked --release

FROM rust:slim-bullseye AS runtime
WORKDIR app
COPY --from=builder /app/target/release/cargo-msrv /usr/local/bin
ENTRYPOINT ["cargo-msrv", "msrv"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ From the Arch Linux [community repository](https://archlinux.org/packages/commun

`pacman -S cargo-msrv`

Also, you can use the following commands for building and running via Docker:

- `docker build -t cargo-msrv .`
- `docker run -t -v "$(pwd)/Cargo.toml":/app/Cargo.toml cargo-msrv`

### Preview

[![asciicast](https://asciinema.org/a/mFs1cjmjhCDinQNepooGelnYF.svg)](https://asciinema.org/a/mFs1cjmjhCDinQNepooGelnYF)
Expand Down

0 comments on commit 156ad5f

Please sign in to comment.