From 22b42c66a322e2d8ab1d8b0be5a0928e91602055 Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Mon, 21 Dec 2020 13:46:15 +0100 Subject: [PATCH] feat: post-fork cleanup --- Dockerfile.alpine | 51 --------------- Dockerfile.debian | 144 ----------------------------------------- Dockerfile.debian-brew | 65 ------------------- Dockerfile.ubuntu | 6 +- README.md | 13 +++- docker-compose.yml | 46 ------------- ssh/authorized_keys | 3 + 7 files changed, 18 insertions(+), 310 deletions(-) delete mode 100644 Dockerfile.alpine delete mode 100644 Dockerfile.debian delete mode 100644 Dockerfile.debian-brew create mode 100644 ssh/authorized_keys diff --git a/Dockerfile.alpine b/Dockerfile.alpine deleted file mode 100644 index 13d2cab..0000000 --- a/Dockerfile.alpine +++ /dev/null @@ -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 " - -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"] diff --git a/Dockerfile.debian b/Dockerfile.debian deleted file mode 100644 index 91606fd..0000000 --- a/Dockerfile.debian +++ /dev/null @@ -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 " - -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 " - -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 " - -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"] diff --git a/Dockerfile.debian-brew b/Dockerfile.debian-brew deleted file mode 100644 index 3858bea..0000000 --- a/Dockerfile.debian-brew +++ /dev/null @@ -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 " - -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"] diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index f33fb76..aeb678e 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -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 " +LABEL maintainer="Tine Jozelj " 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"] + diff --git a/README.md b/README.md index cbbec3c..14456d0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -dotfiles for blink.sh env -========================= +my workspace/environment as a docker container +============================================== @@ -15,6 +15,15 @@ dotfiles for blink.sh env +# 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 diff --git a/docker-compose.yml b/docker-compose.yml index b24933e..8d13a91 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 - - diff --git a/ssh/authorized_keys b/ssh/authorized_keys new file mode 100644 index 0000000..6bf20f3 --- /dev/null +++ b/ssh/authorized_keys @@ -0,0 +1,3 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNvpIu5jb/o+JEivC+/FoNYM4HQ1JOcXV2MnkyosI05 tine+iphone@tjo.cloud +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHrX2u82zWpVhjWng1cR4Kj76SajLJQ/Nmwd2GPaJpt1 tine+ipad@tjo.cloud +