Skip to content

Commit

Permalink
Update Dockerfile to use unprivileged user (#73)
Browse files Browse the repository at this point in the history
* Update Dockerfile to create unprivileged user

Use an unprivileged user because Chrome refuses to run as root (unless the sandbox is deactivated which is not the best solution)

* Update docker instructions

The usage of a unprivileged user means we have to add some parameters
  • Loading branch information
florian-s-code authored Jan 15, 2025
1 parent 542fe52 commit 200894e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ RUN apt-get -y update &&\
rm google-chrome-stable_current_amd64.deb

COPY --from=build-stage /app /app
RUN adduser --system --group --home /home/app app && chown app:app /app
USER app
EXPOSE 7123
CMD ["/app/snd"]
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ xattr -d com.apple.quarantine "/Applications/Sales & Dungeons.app/"

The headless version of Sales & Dungeons (using LibUSB) is also available via a docker container:
1. ``docker pull ghcr.io/bigjk/snd:master`` ([container](https://github.com/BigJk/snd/pkgs/container/snd))
2. ``docker run --expose 7123:7123 --device=/dev/bus/usb -v /some/place/to/persist:/app/userdata ghcr.io/bigjk/snd:master`` (change ``/some/place/to/persist`` to a folder where the user data should be persisted to)
3. Open ``http://127.0.0.1:7123`` in your favorite browser
2. ``docker run -p 7123:7123 --device=/dev/bus/usb --group-add uucp -v /some/place/to/persist:/app/userdata ghcr.io/bigjk/snd:master``
1. change ``/some/place/to/persist`` to a folder where the user data should be persisted to
2. replace `/dev/bus/usb` with the device of your usb/serial printer
3. replace `uucp` with a group (or gid) allowed to read the device file (use `$(stat -c "%g" /dev/bus/usb)` to get the right group)
4. Open ``http://127.0.0.1:7123`` in your favorite browser

<details><summary>Docker Compose Example</summary>

Expand All @@ -101,6 +104,8 @@ services:
- "7123:7123"
devices:
- "/dev/bus/usb"
group_add:
- uucp
volumes:
- "/some/place/to/persist:/app/userdata"
```
Expand Down

0 comments on commit 200894e

Please sign in to comment.