diff --git a/Dockerfile b/Dockerfile index c74216c..108a536 100644 --- a/Dockerfile +++ b/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 ****" \ diff --git a/entrypoint.sh b/entrypoint.sh index 1ebf535..1861a74 100755 --- a/entrypoint.sh +++ b/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}"