Skip to content

Commit

Permalink
ACTIVATE_SUDO to disable sudo by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Vorlent committed Aug 13, 2022
1 parent 93b117b commit 3b01e7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions cozycast-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ RUN export UNAME=$UNAME UID=1000 GID=1000 && \
mkdir -p "/home/${UNAME}" && \
echo "${UNAME}:x:${UID}:${GID}:${UNAME} User,,,:/home/${UNAME}:/bin/bash" >> /etc/passwd && \
echo "${UNAME}:x:${UID}:" >> /etc/group && \
mkdir -p /etc/sudoers.d && \
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \
chmod 0440 /etc/sudoers.d/${UNAME} && \
chown ${UID}:${GID} -R /home/${UNAME} && \
gpasswd -a ${UNAME} audio
mkdir -p /etc/sudoers.d

ENV TINI_VERSION="v0.19.0"
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
Expand Down
10 changes: 10 additions & 0 deletions cozycast-worker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash

if test -z "$ACTIVATE_SUDO"; then
echo "no sudo"
else
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME}
chmod 0440 /etc/sudoers.d/${UNAME}
chown ${UID}:${GID} -R /home/${UNAME}
gpasswd -a ${UNAME} audio
fi

export DISPLAY=":$RANDOM"
sudo chown cozycast:cozycast /home/cozycast

Expand Down

0 comments on commit 3b01e7f

Please sign in to comment.