diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index d1f1c2104..74f53928e 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -174,17 +174,16 @@ 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}" +RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi +RUN usermod -append --groups sudo $(id -nu $UID || echo "user") +RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6) ENV WORK_DIR="${HOME_DIR}/wspace" \ PATH="${HOME_DIR}/.local/bin:${PATH}" -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} -RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME} -RUN chown ${USER} /opt -USER ${USER} +RUN chown --recursive ${UID} ${WORK_DIR} ${ANDROID_SDK_HOME} +RUN chown ${UID} /opt +USER ${UID} # venv, VIRTUAL_ENV is used by buildozer to indicate a venv environment ENV VIRTUAL_ENV=/opt/venv diff --git a/contrib/build-linux/appimage/Dockerfile b/contrib/build-linux/appimage/Dockerfile index 2b5148c64..5f43ac930 100644 --- a/contrib/build-linux/appimage/Dockerfile +++ b/contrib/build-linux/appimage/Dockerfile @@ -75,13 +75,12 @@ RUN apt-get update -q && \ # 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}" +RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi +RUN usermod -append --groups sudo $(id -nu $UID || echo "user") +RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6) ENV WORK_DIR="${HOME_DIR}/wspace" \ PATH="${HOME_DIR}/.local/bin:${PATH}" -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} -RUN chown --recursive ${USER} ${WORK_DIR} -USER ${USER} +RUN chown --recursive ${UID} ${WORK_DIR} +USER ${UID} diff --git a/contrib/build-linux/sdist/Dockerfile b/contrib/build-linux/sdist/Dockerfile index d397e85a7..3b6f12112 100644 --- a/contrib/build-linux/sdist/Dockerfile +++ b/contrib/build-linux/sdist/Dockerfile @@ -18,13 +18,12 @@ RUN apt-get update -q && \ # 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}" +RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi +RUN usermod -append --groups sudo $(id -nu $UID || echo "user") +RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6) ENV WORK_DIR="${HOME_DIR}/wspace" \ PATH="${HOME_DIR}/.local/bin:${PATH}" -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} -RUN chown --recursive ${USER} ${WORK_DIR} -USER ${USER} +RUN chown --recursive ${UID} ${WORK_DIR} +USER ${UID} diff --git a/contrib/build-wine/Dockerfile b/contrib/build-wine/Dockerfile index f62b1da1d..4a7022bce 100644 --- a/contrib/build-wine/Dockerfile +++ b/contrib/build-wine/Dockerfile @@ -58,16 +58,15 @@ RUN DEBIAN_CODENAME=$(lsb_release --codename --short) && \ # 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}" +RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi +RUN usermod -append --groups sudo $(id -nu $UID || echo "user") +RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6) ENV WORK_DIR="${HOME_DIR}/wspace" \ PATH="${HOME_DIR}/.local/bin:${PATH}" -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} -RUN chown --recursive ${USER} ${WORK_DIR} -RUN chown ${USER} /opt -USER ${USER} +RUN chown --recursive ${UID} ${WORK_DIR} +RUN chown ${UID} /opt +USER ${UID} RUN mkdir --parents "/opt/wine64/drive_c/electrum"