Browse Source

UID stuff

pull/5/head
Daniel Gibbs 2 years ago
parent
commit
6f58d2b876
  1. 16
      Dockerfile
  2. 14
      entrypoint.sh

16
Dockerfile

@ -72,24 +72,20 @@ RUN echo "**** Install NodeJS ****" \
RUN echo "**** Install GameDig ****" \
&& npm install -g gamedig
##Need use xterm for LinuxGSM##
ENV DEBIAN_FRONTEND noninteractive
ARG USERNAME=linuxgsm
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG USER_GID=${USER_UID}
## Add linuxgsm user
RUN echo "**** Add linuxgsm user ****" \
# Create the user
&& groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown $USERNAME:$USERNAME /home/$USERNAME
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME} \
&& chown ${USERNAME}:${USERNAME} /home/${USERNAME}
## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \

14
entrypoint.sh

@ -12,15 +12,23 @@ echo "loading exit trap"
trap exit_handler SIGTERM
echo "update permissions for linuxgsm"
sudo chown -R $USER_UID:$USER_GID /home/linuxgsm
if [ -z "${USER_UID}" ]; then
USER_UID=1000
fi
if [ -z "${USER_GID}" ]; then
USER_GID=1000
fi
usermod -u ${USER_UID} linuxgsm
groupmod -g ${USER_GID} linuxgsm
sudo chown -R ${USER_UID}:${USER_GID} /home/linuxgsm
echo -e "Welcome to the LinuxGSM Docker"
echo -e "================================================================================"
echo -e "GAMESERVER: ${GAMESERVER}"
echo -e ""
echo -e "USER: $USERNAME"
echo -e "UID: $USER_UID"
echo -e "GID: $USER_GID"
echo -e "UID: ${USER_UID}"
echo -e "GID: ${USER_GID}"
echo -e ""
echo -e "LGSM_GITHUBUSER: ${LGSM_GITHUBUSER}"
echo -e "LGSM_GITHUBREPO: ${LGSM_GITHUBREPO}"

Loading…
Cancel
Save