dotfiles/Dockerfile.alpine

52 lines
1.8 KiB
Docker
Raw Normal View History

# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
2020-11-30 10:31:22 +00:00
FROM alpine:3.12
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
2020-11-30 10:31:22 +00:00
ARG SSH_USER="${SSH_USER:-blink}"
ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}"
RUN apk --update --no-cache add bash
SHELL ["bash", "-c"]
2020-11-30 10:31:22 +00:00
RUN apk --update --no-cache add \
git \
mosh-server \
neovim \
openssh-server \
tmux \
&& adduser -D "${SSH_USER}" -s /bin/bash \
&& echo -e "${SSH_PASSWORD}\n${SSH_PASSWORD}" | passwd "${SSH_USER}" \
&& ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa \
&& ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519 \
&& chown root:root /etc/ssh \
&& chmod 0600 /etc/ssh/* \
&& mkdir -p /root/.ssh \
&& chmod 0700 /root/.ssh \
&& rm -rf /var/cache/apk/* \
/tmp/* \
/var/tmp/*
COPY . "/home/${SSH_USER}/.dotfiles"/
RUN chown -R "${SSH_USER}:${SSH_USER}" "/home/${SSH_USER}"
USER "${SSH_USER}"
2020-11-30 10:31:22 +00:00
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" \
2020-11-30 10:31:22 +00:00
&& 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
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]