1
0
Fork 0
mirror of https://github.com/alemidev/scope-tui.git synced 2024-11-23 14:14:48 +01:00

Feature: Dockerize project

* Added Dockerfile to build project
* Added docker-compose.yml for easy container orchestration
* Added helper shell script docker_start.sh to easily start and attach the container.
* Added dockerignore file to avoid over-including files.
* Minor update to README to include docker information.
This commit is contained in:
CodexHere 2024-03-12 19:57:46 -05:00
parent c928ea4899
commit 655598e807
6 changed files with 63 additions and 0 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
docker-compose.yml
Dockerfile

View file

@ -8,3 +8,7 @@ indent_size = 4
[*.rs]
indent_size = 2
[*.yml]
indent_size = 2
indent_style = space

18
Dockerfile Normal file
View file

@ -0,0 +1,18 @@
FROM rust:1.76-bookworm
RUN \
apt update && \
apt install -y pulseaudio && \
apt-get clean autoclean && \
rm -rf /var/lib/{apt,dpkg,cache,log}/ && \
mkdir /app && chown 1000:1000 /app
WORKDIR /app
USER 1000
COPY --chown=1000:1000 . /app
RUN cargo build
ENTRYPOINT ["/app/target/release/scope-tui"]
CMD ["pulse"]

View file

@ -60,6 +60,22 @@ The audio buffer size directly impacts resource usage, latency and refresh rate
To change audio buffer size, the PulseAudio client must be restarted. Because of this, such option is configurable only at startup.
## Docker Compose
Included is a simple `Dockerfile` to build the project, and an accompanying `docker-compose.yml` to orchestrate starting the container with the proper volume mounts and environment variables.
Also included is a helper shell script to launch the container, attach to the container instance, and destroy the container on exiting.
```sh
docker compose up -d
docker attach scope_tui
docker compose down
# OR
./docker_start.sh
```
## Controls
* Use `q` or `CTRL+C` to exit
* Use `s` to toggle scatter mode
@ -104,6 +120,7 @@ Some features I plan to work on and would like to add:
* [x] Multiple channels
* [x] Spectroscope
* [x] File source
* [x] Dockerize
* [ ] Mac audio sources
* [ ] Windows audio sources
* [ ] Improve file audio source

15
docker-compose.yml Normal file
View file

@ -0,0 +1,15 @@
version: "3.8"
services:
scope_tui:
container_name: scope_tui
# command: ["--scatter", "pulse"] # Example of customizing options
image: scope_tui
build: .
stdin_open: true
tty: true
environment:
- PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native
volumes:
- ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native
- ~/.config/pulse/cookie:/.config/pulse/cookie

7
docker_start.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
docker compose up -d
docker attach scope_tui
docker compose down