1
0

Merge pull request #8267 from SomberNight/202303_build_userid1000

build: docker scripts to work even if host user id != 1000
This commit is contained in:
ghost43
2023-03-21 17:54:29 +00:00
committed by GitHub
12 changed files with 76 additions and 31 deletions

View File

@@ -141,11 +141,12 @@ RUN apt -y update -qq \
# create new user to avoid using root; but with sudo access and no password for convenience.
ARG UID=1000
ENV USER="user"
ENV HOME_DIR="/home/${USER}"
ENV WORK_DIR="${HOME_DIR}/wspace" \
PATH="${HOME_DIR}/.local/bin:${PATH}"
RUN useradd --create-home --shell /bin/bash ${USER}
RUN useradd --uid $UID --create-home --shell /bin/bash ${USER}
RUN usermod -append --groups sudo ${USER}
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
WORKDIR ${WORK_DIR}