Skip to content

Commit

Permalink
chore: add Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-cw committed Jul 4, 2022
1 parent 47d7222 commit 32ff61a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/engine/ambient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub fn play(events: Receiver<Event>) -> 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(()),
};
Expand Down

0 comments on commit 32ff61a

Please sign in to comment.