Skip to content

Commit

Permalink
Running gcups as non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
fajfer committed Apr 6, 2024
1 parent b9966df commit ad89413
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions gcups/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM docker.io/ubuntu:jammy-20240227
RUN apt-get update && apt-get install --no-install-recommends -y wget gpg xvfb libgbm-dev libasound2 python3-pip && \
RUN apt-get update && apt-get install --no-install-recommends -y wget gpg xvfb libgbm-dev libasound2 python3-pip dbus-user-session && \
wget -qO- https://gcups-static.greencell.global/csgsa-keyring.gpg | gpg --dearmor | dd of=/usr/share/keyrings/csgsa-keyring.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/csgsa-keyring.gpg] https://gcups-static.greencell.global/deb stable non-free" | dd of=/etc/apt/sources.list.d/gcups.list && \
apt-get update -y && apt-get install --no-install-recommends -y gcups && \
Expand All @@ -8,14 +8,17 @@ RUN apt-get update && apt-get install --no-install-recommends -y wget gpg xvfb l
python3 -m pip --no-cache-dir uninstall setuptools wheel && \
apt-get remove -y python3-pip && \
mkdir -m775 -p /opt/gcups/db/gcups-rxdb-1-settings && \
rm -rf /opt/gcups/license /opt/gcups/manuals
rm -rf /opt/gcups/license /opt/gcups/manuals && rm -rf /tmp/* && \
useradd -m gcups && chown -R gcups:gcups /opt/gcups && \
mkdir /var/run/dbus && chown -R gcups:gcups /var/run/dbus

COPY init.sh populate-db.py db.txt /opt/
COPY --chown=gcups:gcups init.sh populate-db.py db.txt /opt/
WORKDIR /opt
RUN python3 populate-db.py

ENV GCUPS_HTTP_PORT=8080
ENV GCUPS_PASSWORD=gcups123
EXPOSE $GCUPS_HTTP_PORT

USER gcups
ENTRYPOINT ["/opt/init.sh"]
6 changes: 4 additions & 2 deletions gcups/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ service dbus start

echo "GCUPS running on port: $GCUPS_HTTP_PORT"
echo "Default webUI password: $GCUPS_PASSWORD"
echo -n "Running gcups " && xvfb-run gcups --version --no-sandbox

xvfb-run \
gcups -vvv --no-sandbox
xvfb-run gcups --no-sandbox
echo "GCUPS webserver started"
tail -f /opt/gcups/log/error.log

0 comments on commit ad89413

Please sign in to comment.