ARG BASE_TAG FROM ${BASE_TAG} ARG USER_NAME=myuser ARG USER_PASSWD=111111 ARG DEBIAN_FRONTEND=noninteractive # Pre-install packages, pip install requirements and run post install script. COPY packages.txt . COPY requirements.txt . COPY postinstallscript.sh . RUN apt-get update && apt-get install -y sudo $(cat packages.txt) RUN pip install --no-cache-dir -r requirements.txt RUN bash postinstallscript.sh # Create a new user and group using the username argument RUN groupadd -r ${USER_NAME} && useradd -r -m -g${USER_NAME} ${USER_NAME} RUN echo "${USER_NAME}:${USER_PASSWD}" | chpasswd RUN usermod -aG sudo ${USER_NAME} USER ${USER_NAME} ENV USER=${USER_NAME} WORKDIR /home/${USER_NAME}/workspace # Set the prompt to highlight the username RUN echo "export PS1='\[\033[01;32m\]\u\[\033[00m\]@\[\033[01;34m\]\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$'" >> /home/${USER_NAME}/.bashrc