dotfiles/Dockerfile.debian-brew
2020-12-02 19:00:22 +01:00

65 lines
2.5 KiB
Docker

# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM debian:buster-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ARG SSH_USER="${SSH_USER:-blink}"
ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}"
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
SHELL ["/bin/bash", "-c"]
RUN set -ueox pipefail \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -yqq update \
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
build-essential \
ca-certificates \
curl \
git \
locales \
openssh-server \
openssl \
psmisc \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen \
&& adduser --quiet --gecos '' --disabled-password --add_extra_groups "${SSH_USER}" \
&& echo -e "${SSH_PASSWORD}\n${SSH_PASSWORD}" | passwd "${SSH_USER}" \
&& git clone --depth 1 https://github.com/Homebrew/brew.git "/home/${SSH_USER}/.linuxbrew" \
&& cd "/home/${SSH_USER}/.linuxbrew" \
&& git config --local --replace-all homebrew.private true \
&& echo "export PATH=\"/home/${SSH_USER}/.linuxbrew/bin:$PATH\"" > "/home/${SSH_USER}/.profile" \
&& chown -R "${SSH_USER}:${SSH_USER}" "/home/${SSH_USER}" \
&& su - "${SSH_USER}" bash -c 'brew >/dev/null 2>&1; brew install --quiet mosh neovim tmux && brew cleanup --prune all >/dev/null 2>&1' \
&& ln -s "/home/${SSH_USER}/.linuxbrew/bin/mosh-server" /usr/bin/mosh-server \
&& ln -s "/home/${SSH_USER}/.linuxbrew/bin/nvim" /usr/bin/nvim \
&& ln -s "/home/${SSH_USER}/.linuxbrew/bin/tmux" /usr/bin/tmux \
&& apt-get -yqq clean all \
&& rm -rf /var/lib/apt/lists/* \
"/home/${SSH_USER}/.linuxbrew/Library/Taps/homebrew/homebrew-core" \
/tmp/* \
/var/tmp/*
COPY . "/home/${SSH_USER}/.dotfiles"/
RUN chown -R "${SSH_USER}:${SSH_USER}" "/home/${SSH_USER}/.dotfiles"
USER "${SSH_USER}"
RUN ln -s "/home/${SSH_USER}/.dotfiles/tmux/tmux.conf" "/home/${SSH_USER}/.tmux.conf" \
&& mkdir -p "/home/${SSH_USER}/.config" \
&& ln -s "/home/${SSH_USER}/.dotfiles/nvim" "/home/${SSH_USER}/.config/nvim" \
&& ln -s "/home/${SSH_USER}/.dotfiles/nvim/vimrc" "/home/${SSH_USER}/.vimrc" \
&& git clone --depth 1 https://github.com/Shougo/dein.vim "/home/${SSH_USER}/.cache/vim/dein/repos/github.com/Shougo/dein.vim" \
&& nvim -V1 -es -i NONE -N --noplugin -u "/home/${SSH_USER}/.config/nvim/config/vimrc" \
-c "try | call dein#clear_state() | call dein#update() | finally | messages | qall! | endtry"
USER root
EXPOSE 22/tcp
EXPOSE 22022/udp
RUN mkdir -p /run/sshd
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]