What follows is a Dockerfile for my Vim settings, so I could use it anywhere.
While it is public, it is not intended for mass usage, and so the face that it creates the password in the build process isn't a problem.
There is no COMMAND
at the end because it is intended to be run with mount. The command I run it with docker run -itv /:/tmp/real_root uberhumus/vim-anywhere:latest vi <Filename>
Was I supposed to COPY
the .vimrc later? Or use ADD
instead? Am I too splurgy with the layers? Is there a smarter way to do the RUN
, WORKDIR
, RUN
situations I ran into?
Thanks!
ENV DEBIAN_FRONTEND=noninteractive
ARG TZ=Asia/Jerusalem
RUN apt-get update; \
apt-get dist-upgrade -y && \
apt-get autoremove -y && \
apt-get autoclean -y && \
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 && \
echo vim-anywhere > /etc/hostname
ARG USERNAME=yotam
RUN PASSWORD=$(openssl rand -base64 16 | tr -d "=") && \
useradd -m -s /bin/bash $USERNAME && \
usermod -aG sudo $USERNAME && \
echo "$USERNAME:$PASSWORD" | chpasswd && \
echo $PASSWORD
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/ && \
git clone --depth 1 https://github.com/dense-analysis/ale.git && \
git clone https://github.com/ycm-core/YouCompleteMe.git
WORKDIR /home/$USERNAME/.vim/pack/plugins/start/YouCompleteMe
RUN git submodule update --init --recursive && \
python3 install.py --all && \
chown -R $USERNAME:$USERNAME /home/$USERNAME
USER $USERNAME```