Skip to content

Commit 200894e

Browse files
Update Dockerfile to use unprivileged user (#73)
* 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
1 parent 542fe52 commit 200894e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ RUN apt-get -y update &&\
3636
rm google-chrome-stable_current_amd64.deb
3737

3838
COPY --from=build-stage /app /app
39+
RUN adduser --system --group --home /home/app app && chown app:app /app
40+
USER app
3941
EXPOSE 7123
4042
CMD ["/app/snd"]

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ xattr -d com.apple.quarantine "/Applications/Sales & Dungeons.app/"
8787

8888
The headless version of Sales & Dungeons (using LibUSB) is also available via a docker container:
8989
1. ``docker pull ghcr.io/bigjk/snd:master`` ([container](https://github.com/BigJk/snd/pkgs/container/snd))
90-
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)
91-
3. Open ``http://127.0.0.1:7123`` in your favorite browser
90+
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``
91+
1. change ``/some/place/to/persist`` to a folder where the user data should be persisted to
92+
2. replace `/dev/bus/usb` with the device of your usb/serial printer
93+
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)
94+
4. Open ``http://127.0.0.1:7123`` in your favorite browser
9295

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

@@ -101,6 +104,8 @@ services:
101104
- "7123:7123"
102105
devices:
103106
- "/dev/bus/usb"
107+
group_add:
108+
- uucp
104109
volumes:
105110
- "/some/place/to/persist:/app/userdata"
106111
```

0 commit comments

Comments
 (0)