From 30e2930dfbb2d8beb51fef290618fac69680149e Mon Sep 17 00:00:00 2001 From: Ahmed AbdelHalim Date: Sat, 1 Jul 2023 22:29:10 +0200 Subject: Add docker image to run rust without installing --- CLI/rust/Dockerfile | 11 +++++++++++ CLI/rust/README.md | 13 +++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 CLI/rust/Dockerfile (limited to 'CLI/rust') diff --git a/CLI/rust/Dockerfile b/CLI/rust/Dockerfile new file mode 100644 index 0000000..271cef6 --- /dev/null +++ b/CLI/rust/Dockerfile @@ -0,0 +1,11 @@ +From rust:1.70 + +RUN rustup install nightly +RUN rustup component add rustfmt + +WORKDIR /app +COPY . . +RUN cargo build +CMD cargo run -- + +VOLUME /app diff --git a/CLI/rust/README.md b/CLI/rust/README.md index bacb505..b7eba7c 100644 --- a/CLI/rust/README.md +++ b/CLI/rust/README.md @@ -39,6 +39,7 @@ OPTIONS: [![asciicast](https://asciinema.org/a/ypprtuwwvQZXRuxZBB5XUNoic.svg)](https://asciinema.org/a/ypprtuwwvQZXRuxZBB5XUNoic) ## Development +### Locally - Install rustup via `curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh` - Install rust stable version for development `rustup update` - Install rust nightly for testing via `rustup install nightly` @@ -47,18 +48,22 @@ OPTIONS: - run `cargo build` to build the crate/CLI binaries. - run `cargo run --` to run the built binaries. +### Docker +- Build: `docker build . -t rust-gol` +- Run: `docker run -it -v .:/app rust-gol run --` + ## Linting -Run `cargo fmt -- --check` +Run `cargo fmt -- --check` or `docker run -it rust-gol cargo fmt -- --check` ## Testing -Run `cargo +nightly test` +Run `cargo +nightly test` or `docker run -it rust-gol cargo +nightly test` ## Documentation -Run `cargo doc` +Run `cargo doc` or `docker run -it -v .:/app rust-gol cargo doc` ## Release - Update the [version](./Cargo.toml) number -- Run `cargo build --release` and commit changes +- Run `cargo build --release` and commit changes (`docker run -it -v .:/app rust-gol cargo build --release`) - Update the [CHANGELOG](./CHANGELOG.md) - Create a git tag `rust/v#{version_number}` ex: `rust/v0.1.1-pre` -- cgit v1.2.3