summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed AbdelHalim <[email protected]>2023-07-01 22:29:10 +0200
committerAhmed AbdelHalim <[email protected]>2023-07-01 22:29:10 +0200
commit30e2930dfbb2d8beb51fef290618fac69680149e (patch)
tree735de8d791c220a08ac3ea649faff9194c183e6e
parentcdd750c42d67729fe8c62d15de34df4d7724cca7 (diff)
Add docker image to run rust without installing
-rw-r--r--CLI/rust/Dockerfile11
-rw-r--r--CLI/rust/README.md13
2 files changed, 20 insertions, 4 deletions
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`