File tree Expand file tree Collapse file tree 4 files changed +26
-30
lines changed
Expand file tree Collapse file tree 4 files changed +26
-30
lines changed Original file line number Diff line number Diff line change @@ -174,17 +174,16 @@ RUN apt -y update -qq \
174174
175175# create new user to avoid using root; but with sudo access and no password for convenience.
176176ARG UID=1000
177- ENV USER="user"
178- ENV HOME_DIR="/home/${USER}"
177+ RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi
178+ RUN usermod -append --groups sudo $(id -nu $UID || echo "user" )
179+ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
180+ RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6)
179181ENV WORK_DIR="${HOME_DIR}/wspace" \
180182 PATH="${HOME_DIR}/.local/bin:${PATH}"
181- RUN useradd --uid $UID --create-home --shell /bin/bash ${USER}
182- RUN usermod -append --groups sudo ${USER}
183- RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
184183WORKDIR ${WORK_DIR}
185- RUN chown --recursive ${USER } ${WORK_DIR} ${ANDROID_SDK_HOME}
186- RUN chown ${USER } /opt
187- USER ${USER }
184+ RUN chown --recursive ${UID } ${WORK_DIR} ${ANDROID_SDK_HOME}
185+ RUN chown ${UID } /opt
186+ USER ${UID }
188187
189188# venv, VIRTUAL_ENV is used by buildozer to indicate a venv environment
190189ENV VIRTUAL_ENV=/opt/venv
Original file line number Diff line number Diff line change @@ -75,13 +75,12 @@ RUN apt-get update -q && \
7575
7676# create new user to avoid using root; but with sudo access and no password for convenience.
7777ARG UID=1000
78- ENV USER="user"
79- ENV HOME_DIR="/home/${USER}"
78+ RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi
79+ RUN usermod -append --groups sudo $(id -nu $UID || echo "user" )
80+ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
81+ RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6)
8082ENV WORK_DIR="${HOME_DIR}/wspace" \
8183 PATH="${HOME_DIR}/.local/bin:${PATH}"
82- RUN useradd --uid $UID --create-home --shell /bin/bash ${USER}
83- RUN usermod -append --groups sudo ${USER}
84- RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
8584WORKDIR ${WORK_DIR}
86- RUN chown --recursive ${USER } ${WORK_DIR}
87- USER ${USER }
85+ RUN chown --recursive ${UID } ${WORK_DIR}
86+ USER ${UID }
Original file line number Diff line number Diff line change @@ -18,13 +18,12 @@ RUN apt-get update -q && \
1818
1919# create new user to avoid using root; but with sudo access and no password for convenience.
2020ARG UID=1000
21- ENV USER="user"
22- ENV HOME_DIR="/home/${USER}"
21+ RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi
22+ RUN usermod -append --groups sudo $(id -nu $UID || echo "user" )
23+ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
24+ RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6)
2325ENV WORK_DIR="${HOME_DIR}/wspace" \
2426 PATH="${HOME_DIR}/.local/bin:${PATH}"
25- RUN useradd --uid $UID --create-home --shell /bin/bash ${USER}
26- RUN usermod -append --groups sudo ${USER}
27- RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
2827WORKDIR ${WORK_DIR}
29- RUN chown --recursive ${USER } ${WORK_DIR}
30- USER ${USER }
28+ RUN chown --recursive ${UID } ${WORK_DIR}
29+ USER ${UID }
Original file line number Diff line number Diff line change @@ -58,16 +58,15 @@ RUN DEBIAN_CODENAME=$(lsb_release --codename --short) && \
5858
5959# create new user to avoid using root; but with sudo access and no password for convenience.
6060ARG UID=1000
61- ENV USER="user"
62- ENV HOME_DIR="/home/${USER}"
61+ RUN if [ "$UID" != "0" ] ; then useradd --uid $UID --create-home --shell /bin/bash "user" ; fi
62+ RUN usermod -append --groups sudo $(id -nu $UID || echo "user" )
63+ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
64+ RUN HOME_DIR=$(getent passwd $UID | cut -d: -f6)
6365ENV WORK_DIR="${HOME_DIR}/wspace" \
6466 PATH="${HOME_DIR}/.local/bin:${PATH}"
65- RUN useradd --uid $UID --create-home --shell /bin/bash ${USER}
66- RUN usermod -append --groups sudo ${USER}
67- RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
6867WORKDIR ${WORK_DIR}
69- RUN chown --recursive ${USER } ${WORK_DIR}
70- RUN chown ${USER } /opt
71- USER ${USER }
68+ RUN chown --recursive ${UID } ${WORK_DIR}
69+ RUN chown ${UID } /opt
70+ USER ${UID }
7271
7372RUN mkdir --parents "/opt/wine64/drive_c/electrum"
You can’t perform that action at this time.
0 commit comments