Dockerfile of Vim + Plugins and .vimrc
The best I've got is:
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
ARG TZ=Asia/Jerusalem
ARG USERNAME=yotam
RUN apt-get update; \
    apt-get dist-upgrade -y &amp;&amp; \
    apt-get autoremove -y &amp;&amp; \
    apt-get autoclean -y &amp;&amp; \
    apt-get install -y vim tmux bash-completion shellcheck ssh git pylint flake8 python sudo expect curl cmake build-essential python3-dev golang npm openjdk-11-jre exuberant-ctags &amp;&amp; \
    useradd -m -s /bin/bash $USERNAME &amp;&amp; \
    usermod -aG sudo $USERNAME &amp;&amp; \ 
    echo vim-anywhere &gt; /etc/hostname

WORKDIR /home/$USERNAME
COPY .vimrc .
RUN mkdir -p ./.vim/pack/plugins/start 
WORKDIR /home/$USERNAME/.vim/pack/plugins/start
RUN git clone https://github.com/tpope/vim-fugitive.git/ &amp;&amp; \
    git clone --depth 1 https://github.com/dense-analysis/ale.git &amp;&amp; \
    git clone https://github.com/ycm-core/YouCompleteMe.git
WORKDIR /home/$USERNAME/.vim/pack/plugins/start/YouCompleteMe
RUN git submodule update --init --recursive &amp;&amp; \
    python3 install.py --all &amp;&amp; \
    chown -R $USERNAME:$USERNAME /home/$USERNAME &amp;&amp; \
    PASSWORD=$(openssl rand -base64 16 | tr -d &quot;=&quot;) &amp;&amp; \
    echo &quot;$USERNAME:$PASSWORD&quot; | chpasswd &amp;&amp; \
    echo $PASSWORD
WORKDIR /home/$USERNAME
USER $USERNAME

This gives me only minor advantages which are:

The password is echoed at the end of the build and is easier to find in the output.
The return to the homedir at the end is more what you'd intuitively expect.