feat: post-fork cleanup

This commit is contained in:
Tine Jozelj 2020-12-21 13:46:15 +01:00
parent 1f89051b18
commit 22b42c66a3
No known key found for this signature in database
GPG key ID: 3818B74E3830D7CF
7 changed files with 18 additions and 310 deletions

View file

@ -1,51 +0,0 @@
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM alpine:3.12
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ARG SSH_USER="${SSH_USER:-blink}"
ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}"
RUN apk --update --no-cache add bash
SHELL ["bash", "-c"]
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}"
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
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]

View file

@ -1,144 +0,0 @@
# 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 sed -i "s|tmux-256color|xterm-256color|g" "/home/${SSH_USER}/.dotfiles/tmux/tmux.conf" \
&& 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"]

View file

@ -1,65 +0,0 @@
# 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"]

View file

@ -1,7 +1,8 @@
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM ubuntu:20.10
ARG ARCH=
FROM ${ARCH}ubuntu:20.10
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
ARG SSH_USER="${SSH_USER:-blink}"
ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}"
@ -52,3 +53,4 @@ EXPOSE 22022/udp
RUN mkdir -p /run/sshd
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]

View file

@ -1,5 +1,5 @@
dotfiles for blink.sh env
=========================
my workspace/environment as a docker container
==============================================
<!-- MarkdownTOC autolink="true" uri_encoding="false" levels="1,2,3,4,5,6" GFM -->
@ -15,6 +15,15 @@ dotfiles for blink.sh env
<!-- /MarkdownTOC -->
# TODO:
- [ ] Multiarch build
- [ ] Github actions
- [ ] Add the tools i use
- zsh, spaceship-prompt, git
- [ ] Add the configurations i have
- zsh, git, nextcloud
# Introduction
[blink shell](https://blink.sh) is an excellent minimalistic SSH and mosh client

View file

@ -1,36 +1,6 @@
version: '3.9'
services:
alpine:
build:
context: .
dockerfile: Dockerfile.alpine
image: blink-dotfiles:alpine
environment:
- SSH_USER=blink
- SSH_PASSWORD=blnik
user: ${SSH_USER}
volumes:
- .:/usr/src/blink-dotfiles
ports:
- 0.0.0.0:22022:22/tcp
- 0.0.0.0:22022:22022/udp
debian:
build:
context: .
dockerfile: Dockerfile.debian
image: blink-dotfiles:debian
environment:
- SSH_USER=blink
- SSH_PASSWORD=blnik
user: ${SSH_USER}
volumes:
- .:/usr/src/blink-dotfiles
ports:
- 0.0.0.0:22022:22/tcp
- 0.0.0.0:22022:22022/udp
ubuntu:
build:
context: .
@ -46,19 +16,3 @@ services:
- 0.0.0.0:22022:22/tcp
- 0.0.0.0:22022:22022/udp
brew:
build:
context: .
dockerfile: Dockerfile.debian-brew
image: blink-dotfiles:debian-brew
environment:
- SSH_USER=blink
- SSH_PASSWORD=blnik
user: ${SSH_USER}
volumes:
- .:/usr/src/blink-dotfiles
ports:
- 0.0.0.0:22022:22/tcp
- 0.0.0.0:22022:22022/udp

3
ssh/authorized_keys Normal file
View file

@ -0,0 +1,3 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNvpIu5jb/o+JEivC+/FoNYM4HQ1JOcXV2MnkyosI05 tine+iphone@tjo.cloud
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHrX2u82zWpVhjWng1cR4Kj76SajLJQ/Nmwd2GPaJpt1 tine+ipad@tjo.cloud