mirror of
https://github.com/mentos1386/dotfiles.git
synced 2025-01-31 00:35:42 +00:00
Docker services based on debian and ubuntu
This commit is contained in:
parent
d188abec02
commit
65e939e18e
7 changed files with 342 additions and 9 deletions
|
@ -1,10 +1,16 @@
|
|||
# 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 \
|
||||
bash \
|
||||
git \
|
||||
mosh-server \
|
||||
neovim \
|
||||
|
@ -24,20 +30,16 @@ RUN apk --update --no-cache add \
|
|||
/tmp/* \
|
||||
/var/tmp/*
|
||||
|
||||
SHELL ["bash", "-c"]
|
||||
|
||||
#COPY ssh_config /etc/ssh/ssh_config
|
||||
#COPY sshd_config /etc/ssh/sshd_config
|
||||
|
||||
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 https://github.com/Shougo/dein.vim "/home/${SSH_USER}/.cache/vim/dein/repos/github.com/Shougo/dein.vim" \
|
||||
&& 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"
|
||||
|
||||
|
|
143
Dockerfile.debian
Normal file
143
Dockerfile.debian
Normal file
|
@ -0,0 +1,143 @@
|
|||
# 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"]
|
65
Dockerfile.debian-brew
Normal file
65
Dockerfile.debian-brew
Normal file
|
@ -0,0 +1,65 @@
|
|||
# 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"]
|
54
Dockerfile.ubuntu
Normal file
54
Dockerfile.ubuntu
Normal file
|
@ -0,0 +1,54 @@
|
|||
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
|
||||
FROM ubuntu:20.10
|
||||
|
||||
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 \
|
||||
git \
|
||||
ca-certificates \
|
||||
locales \
|
||||
mosh \
|
||||
openssh-server \
|
||||
psmisc \
|
||||
tmux \
|
||||
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"]
|
23
README.md
23
README.md
|
@ -74,11 +74,32 @@ It is possible to test stuff with docker. Given dockerfiles just contains `opens
|
|||
and `mosh-server`, and minimal setup to get things working. It is possible to
|
||||
test them directly from the blink shell
|
||||
|
||||
Supported docker services (and operating systems):
|
||||
|
||||
- alpine
|
||||
|
||||
tmux, mosh and neovim installed with apk, clipboard does not work with mosh;
|
||||
|
||||
- debian
|
||||
|
||||
tmux and mosh compiled, vim installed as a package. Clipboard works correctly;
|
||||
|
||||
- brew
|
||||
|
||||
debian with homebrew installed. tmux, mosh and neovim installed with brew,
|
||||
everything works;
|
||||
|
||||
- ubuntu
|
||||
|
||||
ubunut 20.10 with apt-get installed tmux, mosh and vim. Clipboard works
|
||||
correctly.
|
||||
|
||||
## Start and stop service
|
||||
|
||||
To start:
|
||||
|
||||
```shell
|
||||
# assign alpine, debian, brew or ubuntu to the SERVICE
|
||||
SERVICE=alpine && \
|
||||
docker-compose build --force-rm --pull ${SERVICE} && \
|
||||
docker-compose up -d ${SERVICE} && \
|
||||
|
@ -96,7 +117,7 @@ docker-compose rm --stop --force
|
|||
Each time when you build new docker image, SSH keys would be updated, so cleanup
|
||||
known hosts file first:
|
||||
|
||||
```
|
||||
```shell
|
||||
rm ~/.ssh/known_hosts
|
||||
```
|
||||
|
||||
|
|
|
@ -15,3 +15,50 @@ services:
|
|||
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: .
|
||||
dockerfile: Dockerfile.ubuntu
|
||||
image: blink-dotfiles:ubuntu
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
" Note: Skip initialization for vim-tiny or vim-small.
|
||||
if 1
|
||||
execute 'source' fnamemodify(expand('<sfile>'), ':h').'/config/vimrc'
|
||||
" execute 'source' fnamemodify(expand('<sfile>'), ':h').'/config/vimrc'
|
||||
source ~/.config/nvim/config/vimrc
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue