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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user