2020-12-02 18:00:22 +00:00
|
|
|
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
|
2020-12-21 13:50:40 +00:00
|
|
|
FROM ubuntu:20.10
|
2020-12-02 18:00:22 +00:00
|
|
|
|
2020-12-21 12:46:15 +00:00
|
|
|
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
|
2020-12-23 19:31:35 +00:00
|
|
|
LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace
|
2020-12-02 18:00:22 +00:00
|
|
|
|
2020-12-24 11:47:12 +00:00
|
|
|
ARG SSH_USER="${SSH_USER:-tine}"
|
2020-12-02 18:00:22 +00:00
|
|
|
|
|
|
|
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 \
|
|
|
|
ca-certificates \
|
|
|
|
locales \
|
|
|
|
mosh \
|
|
|
|
openssh-server \
|
|
|
|
psmisc \
|
2020-12-24 13:51:49 +00:00
|
|
|
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
|
|
|
|
&& locale-gen \
|
2020-12-02 18:00:22 +00:00
|
|
|
&& adduser --quiet --gecos '' --disabled-password --add_extra_groups "${SSH_USER}" \
|
|
|
|
&& apt-get -yqq clean all \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
/tmp/* \
|
|
|
|
/var/tmp/*
|
|
|
|
|
2020-12-24 13:51:49 +00:00
|
|
|
# Configure SSH
|
|
|
|
RUN touch /etc/ssh/sshd_config.d/custom \
|
|
|
|
&& echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config.d/custom \
|
|
|
|
&& echo "PasswordAuthentication no" >> /etc/ssh/sshd_config.d/custom \
|
|
|
|
&& echo "UsePAM no" >> /etc/ssh/sshd_config.d/custom \
|
|
|
|
&& echo "X11Forwarding no" >> /etc/ssh/sshd_config.d/custom
|
|
|
|
|
2020-12-24 11:36:43 +00:00
|
|
|
# Install available packages
|
|
|
|
RUN set -ueox pipefail \
|
|
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
2020-12-24 11:41:12 +00:00
|
|
|
&& apt-get -yqq update \
|
2020-12-24 11:36:43 +00:00
|
|
|
&& apt-get -yqq --no-install-recommends --no-install-suggests install \
|
2020-12-24 11:41:12 +00:00
|
|
|
git \
|
|
|
|
tmux \
|
|
|
|
vim \
|
|
|
|
zsh \
|
2020-12-24 11:36:43 +00:00
|
|
|
&& apt-get -yqq clean all \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
/tmp/* \
|
|
|
|
/var/tmp/*
|
|
|
|
|
|
|
|
# Install other packages
|
|
|
|
COPY --from=ghcr.io/mentos1386/starship:0.47.0 /starship /usr/local/bin/starship
|
|
|
|
COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /kubectl /usr/local/bin/kubectl
|
2020-12-24 13:51:49 +00:00
|
|
|
# Golang
|
|
|
|
COPY --from=golang:1.15.6 --chown=${SSH_USER} /usr/local/go /home/${SSH_USER}/.go
|
|
|
|
ENV PATH=/home/${SSH_USER}/.go/bin:$PATH
|
|
|
|
# Rust
|
|
|
|
COPY --from=rust:1.48.0 --chown=${SSH_USER} /usr/local/cargo /home/${SSH_USER}/.cargo
|
|
|
|
COPY --from=rust:1.48.0 --chown=${SSH_USER} /usr/local/rustup /home/${SSH_USER}/.rustup
|
|
|
|
ENV CARGO_HOME=/home/${SSH_USER}/.cargo
|
|
|
|
ENV RUSTUP_HOME=/home/${SSH_USER}/.rustup
|
|
|
|
ENV PATH=/home/${SSH_USER}/.cargo/bin:$PATH
|
|
|
|
# Node
|
|
|
|
COPY --from=node:15.5.0 --chown=${SSH_USER} /usr/local/bin/node /usr/local/bin/node
|
|
|
|
# TODO: Add yarbn/npm/npx/yarnpkg??
|
2020-12-24 11:36:43 +00:00
|
|
|
|
|
|
|
# Create .dotfiles
|
|
|
|
COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles
|
2020-12-02 18:00:22 +00:00
|
|
|
|
2020-12-24 11:36:43 +00:00
|
|
|
# Set ZSH for SSH_USER
|
|
|
|
RUN chsh -s $(which zsh) ${SSH_USER}
|
|
|
|
|
|
|
|
# User Configuration
|
2020-12-02 18:00:22 +00:00
|
|
|
USER "${SSH_USER}"
|
|
|
|
|
2020-12-24 11:36:43 +00:00
|
|
|
# GIT
|
|
|
|
RUN ln -s /home/${SSH_USER}/.dotfiles/git/gitconfig /home/${SSH_USER}/.gitconfig
|
|
|
|
# ZSH
|
|
|
|
RUN ln -s /home/${SSH_USER}/.dotfiles/zsh/zshrc /home/${SSH_USER}/.zshrc
|
|
|
|
# TMUX
|
|
|
|
RUN ln -s /home/${SSH_USER}/.dotfiles/tmux/tmux.conf /home/${SSH_USER}/.tmux.conf
|
|
|
|
# VIM
|
|
|
|
RUN mkdir -p "/home/${SSH_USER}/.config" \
|
2020-12-02 18:00:22 +00:00
|
|
|
&& 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"
|
2020-12-24 11:36:43 +00:00
|
|
|
# SSH
|
|
|
|
RUN mkdir -p /home/${SSH_USER}/.ssh \
|
|
|
|
&& ln -s /home/${SSH_USER}/.dotfiles/ssh/authorized_keys /home/${SSH_USER}/.ssh/authorized_keys
|
2020-12-02 18:00:22 +00:00
|
|
|
|
2020-12-24 11:36:43 +00:00
|
|
|
# Start SSH Daemon
|
2020-12-02 18:00:22 +00:00
|
|
|
USER root
|
|
|
|
EXPOSE 22/tcp
|
|
|
|
EXPOSE 22022/udp
|
|
|
|
RUN mkdir -p /run/sshd
|
|
|
|
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]
|
2020-12-21 12:46:15 +00:00
|
|
|
|