diff --git a/Dockerfile.fedora b/Dockerfile.fedora index dd3de16..a731f01 100644 --- a/Dockerfile.fedora +++ b/Dockerfile.fedora @@ -4,42 +4,64 @@ FROM fedora:33 LABEL maintainer="Tine Jozelj " LABEL org.opencontainers.image.source https://github.com/mentos1386/env -ARG SSH_USER="${SSH_USER:-blink}" -ARG SSH_PASSWORD="${SSH_PASSWORD:-blink}" +ARG SSH_USER="${SSH_USER:-tine}" SHELL ["/bin/bash", "-c"] RUN set -ueox pipefail \ && dnf -y update \ && dnf -y install \ - git \ ca-certificates \ mosh \ openssh-server \ psmisc \ - tmux \ - vim \ + util-linux-user \ && adduser "${SSH_USER}" \ && dnf clean all \ && rm -rf /tmp/* /var/tmp/* -COPY . "/home/${SSH_USER}/.dotfiles"/ -RUN chown -R "${SSH_USER}:${SSH_USER}" "/home/${SSH_USER}/.dotfiles" +# Install available packages +RUN set -ueox pipefail \ +&& dnf -y update \ +&& dnf -y install \ + git \ + tmux \ + vim \ + zsh \ +&& dnf clean all \ +&& rm -rf /tmp/* /var/tmp/* +# Install self compiled packages +COPY --from=ghcr.io/mentos1386/starship:0.47.0 /starship /usr/local/bin/starship + +# 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 USER "${SSH_USER}" -RUN ln -s "/home/${SSH_USER}/.dotfiles/tmux/tmux.conf" "/home/${SSH_USER}/.tmux.conf" \ -&& mkdir -p "/home/${SSH_USER}/.config" \ +# 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" \ && 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 +# Start SSH Daemon 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/Makefile b/Makefile new file mode 100644 index 0000000..d7180fc --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: fedora ubuntu packages all + +fedora: + @docker buildx build --load -t env-fedora -f Dockerfile.fedora . + +ubuntu: + @docker buildx build --load -t env-ubuntu -f Dockerfile.ubuntu . + +packages: + @docker buildx build --load -t starship:0.47.0 -f packages/Dockerfile.starship packages/ + +all: packages fedora ubuntu + diff --git a/README.md b/README.md index 1633355..b432902 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,6 @@ my workspace/environment as a docker container - zsh, git, nextcloud - [ ] GUI using VNC? -# How to build - -``` -$ docker run -it --rm --privileged tonistiigi/binfmt --install all - -# ...install buildx - -# Build ubuntu for arm64 -$ docker buildx build -f Dockerfile.ubuntu --platform linux/arm64 . -``` # Introduction diff --git a/bin/colorband b/dotfiles/bin/colorband similarity index 100% rename from bin/colorband rename to dotfiles/bin/colorband diff --git a/bin/colortest b/dotfiles/bin/colortest similarity index 100% rename from bin/colortest rename to dotfiles/bin/colortest diff --git a/nvim/Makefile b/dotfiles/nvim/Makefile similarity index 100% rename from nvim/Makefile rename to dotfiles/nvim/Makefile diff --git a/nvim/config/vimrc b/dotfiles/nvim/config/vimrc similarity index 100% rename from nvim/config/vimrc rename to dotfiles/nvim/config/vimrc diff --git a/nvim/init.vim b/dotfiles/nvim/init.vim similarity index 100% rename from nvim/init.vim rename to dotfiles/nvim/init.vim diff --git a/nvim/vimrc b/dotfiles/nvim/vimrc similarity index 100% rename from nvim/vimrc rename to dotfiles/nvim/vimrc diff --git a/ssh/authorized_keys b/dotfiles/ssh/authorized_keys similarity index 100% rename from ssh/authorized_keys rename to dotfiles/ssh/authorized_keys diff --git a/tmux/tmux.conf b/dotfiles/tmux/tmux.conf similarity index 100% rename from tmux/tmux.conf rename to dotfiles/tmux/tmux.conf diff --git a/dotfiles/zsh/zshrc b/dotfiles/zsh/zshrc new file mode 100644 index 0000000..2522ba0 --- /dev/null +++ b/dotfiles/zsh/zshrc @@ -0,0 +1,3 @@ +# Starship +eval "$(starship init zsh)" +