dotfiles/Dockerfile.fedora

71 lines
2.1 KiB
Text
Raw Normal View History

2020-12-21 17:06:30 +00:00
# vim: set fenc=utf-8 ts=2 sw=2 sts=2 et ft=Dockerfile :
FROM fedora:33
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-21 17:06:30 +00:00
ARG SSH_USER="${SSH_USER:-tine}"
2020-12-21 17:06:30 +00:00
SHELL ["/bin/bash", "-c"]
RUN set -ueox pipefail \
&& dnf -y update \
&& dnf -y install \
ca-certificates \
mosh \
openssh-server \
psmisc \
util-linux-user \
&& adduser "${SSH_USER}" \
&& dnf clean all \
&& rm -rf /tmp/* /var/tmp/*
# Install available packages
RUN set -ueox pipefail \
&& dnf -y update \
&& dnf -y install \
git \
2020-12-21 17:06:30 +00:00
tmux \
vim \
zsh \
2020-12-21 17:06:30 +00:00
&& dnf clean all \
&& rm -rf /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-21 17:06:30 +00:00
# Create .dotfiles
COPY --chown=${SSH_USER}:${SSH_USER} dotfiles /home/${SSH_USER}/.dotfiles
# Set ZSH for SSH_USER
RUN chsh -s $(which zsh) ${SSH_USER}
# User Configuration
2020-12-21 17:06:30 +00:00
USER "${SSH_USER}"
2020-12-23 17:57:56 +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-21 17:06:30 +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"
# 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-21 17:06:30 +00:00
# Start SSH Daemon
2020-12-21 17:06:30 +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"]