From 32ff61a7a2bd41f50ac6363656be0a83b36a9eb2 Mon Sep 17 00:00:00 2001 From: arthur-cw Date: Mon, 4 Jul 2022 15:43:46 -0300 Subject: [PATCH] chore: add Docker support --- Dockerfile | 9 +++++++++ README.md | 28 +++++++++++++++++++++++++++- src/engine/ambient.rs | 6 +++--- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b4566e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:1.61-slim-bullseye + +WORKDIR /app +COPY ./ /app + +RUN apt update && apt -y install build-essential pkg-config libasound2-dev libssl-dev +RUN cargo build --release +RUN chmod +x /app/target/release/chaintrak +ENTRYPOINT ["/app/target/release/chaintrak"] diff --git a/README.md b/README.md index 6a2e0ec..451d67d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,10 @@ pick one: ### install -you can either [download the binary](https://github.com/arthur-cw/chaintrak/releases) or build it from source yourself +you can either: +- [download the binary](https://github.com/arthur-cw/chaintrak/releases) +- build it from source +- use Docker ##### build from source - install dependencies. the main one is ALSA, check the name of the libs for your OS. no Windows support for now, sorry. @@ -32,6 +35,29 @@ sudo apt update && sudo apt install -y libasound2-dev pkg-config ./target/release/chaintrak ambient ``` +##### use Docker +use `sudo` if necessary + +first build it (only needs to be done once) +``` sh +docker build -t chaintrak . +``` + +then simply run it whenever you want and choose the vibe you're into +``` sh +docker run -it --rm --name chaintrak --device /dev/snd chaintrak jazz +``` +or +``` sh +docker run -it --rm --name chaintrak --device /dev/snd chaintrak ambient +``` + +to stop the application: + +``` sh +docker stop chaintrak +``` + #### TODO - normalize volumes - improve logs (show contract name) diff --git a/src/engine/ambient.rs b/src/engine/ambient.rs index 613346a..0b36c47 100644 --- a/src/engine/ambient.rs +++ b/src/engine/ambient.rs @@ -23,9 +23,9 @@ pub fn play(events: Receiver) -> anyhow::Result<()> { match events.try_recv() { Ok(Event::Block) => soundscape = true, Ok(Event::PixCashier) => badger = true, - Ok(Event::SpinMachine) => synth = true, - Ok(Event::Brlc) => pad = true, - Ok(Event::Compound) => ambience = true, + Ok(Event::SpinMachine) => ambience = true, + Ok(Event::Brlc) => synth = true, + Ok(Event::Compound) => pad = true, Err(TryRecvError::Empty) => break, Err(TryRecvError::Disconnected) => return Ok(()), };