Skip to content

Commit

Permalink
test setting envs for system user bus
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Nov 17, 2023
1 parent 0cd94b5 commit ee95822
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions ci/ci-debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,24 @@ RUN export DEBIAN_FRONTEND=noninteractive \

# Base Target for setting up the default user. user can be selected with the docker '--user YYY' option
FROM base as user
ARG USER=pi
ARG USER_GROUP=$USER
ARG USER_NAME=pi
ARG USER_GROUP=$USER_NAME
ARG USER_ID=1000

ENV USER=$USER USER_GROUP=$USER_GROUP
ENV TEST_USER_GROUP=test
RUN groupadd --gid 1002 $TEST_USER_GROUP

RUN groupadd --gid 1000 $USER_GROUP \
&& useradd -u 1000 -g $USER_GROUP -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER \
&& echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER
# ------
&& useradd -u $USER_ID -g $USER_GROUP -G sudo,$TEST_USER_GROUP -d /home/$USER_NAME -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER_NAME \
&& echo "$USER_NAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER_NAME

ENV XDG_RUNTIME_DIR=/run/user/$USER_ID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$USER_ID/bus
# ------

####### Test Targets #######

# Target for setting up an alternativ user 'hans:wurst'. user can be selected with the docker '--user YYY' option
FROM user as test-user

ENV TEST_USER_GROUP=test

RUN groupadd --gid 1002 $TEST_USER_GROUP \
&& usermod -a -G $TEST_USER_GROUP $USER

RUN export USER_ALT=hans \
&& export USER_ALT_GROUP=wurst \
&& groupadd --gid 1001 $USER_ALT_GROUP \
Expand Down

0 comments on commit ee95822

Please sign in to comment.