diff --git a/dev/Dockerfile b/dev/Dockerfile index 3974970..b87e8f9 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -1,35 +1,22 @@ FROM docker.io/library/archlinux:latest RUN pacman -Syu --noconfirm && \ - pacman -S --needed --noconfirm sudo man-db exa curl jq ffmpeg imagemagick nnn \ - screen tmux groff openssh base-devel git neovim ripgrep fzf emacs \ - python python-pip python-virtualenv go go-tools clang nodejs npm php \ - cargo texlive-core texlive-fontsextra r && \ - mkdir -p /var/run/sshd - -RUN ssh-keygen -A - -RUN useradd -ms /bin/bash dev && \ + pacman -S --needed --noconfirm sudo curl jq openssh git && \ + mkdir -p /var/run/sshd && \ + ssh-keygen -A && \ + useradd -ms /bin/bash dev && \ echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER dev -RUN echo "HOSTNAME=''" >> ~/.bash_profile && \ - echo ". ~/.config/shell/env-min" >> ~/.bash_profile && \ - echo ". ~/.config/shell/bashrc" >> ~/.bashrc - -RUN mkdir -p ~/.ssh && \ - ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" - ARG FJP -# Allow ssh from keys in foregejo instance -RUN curl -sH "Authorization: token $FJP" https://git.tavo.one/api/v1/users/tavo/keys | \ +RUN mkdir -p ~/.ssh && \ + ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" && \ + curl -sH "Authorization: token $FJP" https://git.tavo.one/api/v1/users/tavo/keys | \ jq | grep '"key"' | cut -d '"' -f 4 >> ~/.ssh/authorized_keys && \ - chmod 600 ~/.ssh/authorized_keys - -# Add new "dev" key in the forgejo instance -RUN NEW_KEY=$(cat ~/.ssh/id_ed25519.pub | cut -d' ' -f 1,2) && \ + chmod 600 ~/.ssh/authorized_keys && \ + NEW_KEY=$(cat ~/.ssh/id_ed25519.pub | cut -d' ' -f 1,2) && \ OLD_KEY="$(curl -s "https://git.tavo.one/api/v1/users/tavo/keys" \ -H "Authorization: token $FJP" \ -H "accept: application/json" \ @@ -46,23 +33,10 @@ RUN NEW_KEY=$(cat ~/.ssh/id_ed25519.pub | cut -d' ' -f 1,2) && \ -H "Authorization: token $FJP" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ - -d "$JSON" - -# Add SSH Host Key for git.tavo.one and clone -RUN ssh-keyscan -H git.tavo.one >> ~/.ssh/known_hosts && \ + -d "$JSON" && \ + ssh-keyscan -H git.tavo.one >> ~/.ssh/known_hosts && \ chmod 600 ~/.ssh/known_hosts -RUN git clone git@git.tavo.one:tavo/dotfiles.git ~/.config - -RUN sudo pacman -S --needed git base-devel && \ - sudo mkdir -p /opt/yay && \ - sudo chown -R dev:dev /opt/yay && \ - git clone https://aur.archlinux.org/yay.git /opt/yay && \ - (cd /opt/yay && makepkg -si --noconfirm) - -RUN LV_BRANCH='release-1.4/neovim-0.9' \ - bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh) - USER root EXPOSE 22 diff --git a/dev/setup.sh b/dev/setup.sh new file mode 100644 index 0000000..1620bd9 --- /dev/null +++ b/dev/setup.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +echo "HOSTNAME=''" >> ~/.bash_profile +echo ". ~/.config/shell/env-min" >> ~/.bash_profile +echo ". ~/.config/shell/bashrc" >> ~/.bashrc + +sudo pacman -S --needed --noconfirm sudo man-db exa curl jq ffmpeg imagemagick \ + nnn screen tmux groff openssh base-devel git neovim ripgrep fzf emacs \ + python python-pip python-virtualenv go go-tools clang nodejs npm php cargo \ + texlive-core texlive-fontsextra r + +git clone git@git.tavo.one:tavo/dotfiles.git ~/.config + +sudo pacman -S --needed git base-devel +sudo mkdir -p /opt/yay +sudo chown -R dev:dev /opt/yay +git clone https://aur.archlinux.org/yay.git /opt/yay +(cd /opt/yay && makepkg -si --noconfirm) + +LV_BRANCH='release-1.4/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)