dotfiles/Dockerfile.debian

144 lines
3.9 KiB
Text
Raw Normal View History

# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM debian:buster-slim as tmux
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
SHELL ["/bin/bash", "-c"]
WORKDIR /usr/src
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 \
libevent-2.1.6 \
libevent-dev \
libncurses5 \
libncurses5-dev \
&& curl -L https://github.com/tmux/tmux/releases/download/3.1c/tmux-3.1c.tar.gz | tar -xz \
&& cd tmux-3.1c \
&& ./configure \
&& make
################################################################################
FROM debian:buster-slim as mosh
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
SHELL ["/bin/bash", "-c"]
WORKDIR /usr/src
RUN set -ueox pipefail \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -yqq update \
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
autoconf \
automake \
build-essential \
ca-certificates \
curl \
git \
libboost-dev \
libbsd-dev \
libbsd0 \
libcbor-dev \
libcbor0 \
libedit-dev \
libedit2 \
libncurses5 \
libncurses5-dev \
libprotobuf-dev \
libprotobuf17 \
libssl-dev \
libutempter-dev \
libutempter0 \
pkg-config \
protobuf-compiler \
zlib1g-dev
# # stable version
# RUN curl -L https://github.com/mobile-shell/mosh/releases/download/mosh-1.3.2/mosh-1.3.2.tar.gz | tar -xz \
# && mv mosh-1.3.2 mosh \
# && cd mosh \
# && ./configure \
# && make
# git version
RUN git clone --depth 1 https://github.com/mobile-shell/mosh.git mosh \
&& cd mosh \
&& ./autogen.sh \
&& ./configure \
&& make
################################################################################
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"]
COPY --from=tmux /usr/src/tmux-3.1c/tmux /usr/bin/tmux
COPY --from=mosh /usr/src/mosh/src/frontend/mosh-client /usr/bin/mosh-client
COPY --from=mosh /usr/src/mosh/src/frontend/mosh-server /usr/bin/mosh-server
RUN set -ueox pipefail \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -yqq update \
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
ca-certificates \
git \
libbsd0 \
libcbor0 \
libedit2 \
libevent-2.1.6 \
libio-pty-perl \
libncurses5 \
libprotobuf17 \
libutempter0 \
locales \
openssh-client \
openssh-server \
openssl \
psmisc \
vim \
&& 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}" \
&& apt-get -yqq clean all \
&& rm -rf /var/lib/apt/lists/* \
/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" \
&& vim -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"]