-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add install script and update builds (#7)
* Add an install script that detects OS (alpine and ubuntu only for now) * Add a full and minimal version for each base image build * Fix for runtime error in fzf-lua * Add bash lsp to ensure installed
- Loading branch information
1 parent
fce062b
commit 4e76c3e
Showing
11 changed files
with
268 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,5 @@ src | |
tests | ||
bin | ||
^/Dockerfile.* | ||
install.sh | ||
.*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,65 +9,10 @@ ARG USERNAME=maurice | |
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
ARG HOME=/home/$USERNAME | ||
ARG INSTALL_TYPE=mini | ||
|
||
# Alpine uses MUSL binaries | ||
# Install required packages | ||
RUN apk -q --no-progress --no-cache add \ | ||
# coreutils is for dircolors, procps is for vim-tmux-navigator | ||
# build-base installs a C compiler for nvim-treesitter | ||
sudo zsh coreutils tar bzip2 rlwrap curl git vim stow openssh tmux procps build-base xclip \ | ||
# Busybox binaries (default) doesn't support all features. E.g. `grep -P` | ||
grep \ | ||
# util-linux-misc is for script | ||
neovim bash util-linux-misc nodejs npm \ | ||
# Entry in man | ||
mandoc man-pages less \ | ||
# Install the documentation companion package | ||
docs && \ | ||
# Manual install of man pages for release binaries | ||
mkdir -p /usr/local/share/man/man1 && \ | ||
# Install MUSL ripgrep from source | ||
RIPGREP_VERSION=$(curl -sL "https://api.github.com/repos/BurntSushi/ripgrep/releases/latest" | grep tag_name | cut -d '"' -f4) && \ | ||
curl -sL https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl.tar.gz \ | ||
| tar xz ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl/rg ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl/doc/rg.1 --strip-components=1 && \ | ||
install rg /usr/local/bin && mv doc/rg.1 /usr/local/share/man/man1 && rm -r rg doc && \ | ||
# Install MUSL fd from source | ||
FD_VERSION=$(curl -sL "https://api.github.com/repos/sharkdp/fd/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') && \ | ||
curl -sL https://github.com/sharkdp/fd/releases/download/v${FD_VERSION}/fd-v${FD_VERSION}-x86_64-unknown-linux-musl.tar.gz \ | ||
| tar xz fd-v${FD_VERSION}-x86_64-unknown-linux-musl/fd fd-v${FD_VERSION}-x86_64-unknown-linux-musl/fd.1 --strip-components=1 && \ | ||
install fd /usr/local/bin && mv fd.1 /usr/local/share/man/man1 && rm fd && \ | ||
# Install MUSL bat from source | ||
BAT_VERSION=$(curl -sL "https://api.github.com/repos/sharkdp/bat/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') && \ | ||
curl -sL https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat-v${BAT_VERSION}-x86_64-unknown-linux-musl.tar.gz \ | ||
| tar xz bat-v${BAT_VERSION}-x86_64-unknown-linux-musl/bat bat-v${BAT_VERSION}-x86_64-unknown-linux-musl/bat.1 --strip-components=1 && \ | ||
install bat /usr/local/bin && mv bat.1 /usr/local/share/man/man1 && rm bat && \ | ||
# Install MUSL eza from source | ||
EZA_VERSION=$(curl -sL "https://api.github.com/repos/eza-community/eza/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') && \ | ||
curl -sL https://github.com/eza-community/eza/releases/latest/download/eza_x86_64-unknown-linux-musl.tar.gz | tar xz && \ | ||
curl -sL https://github.com/eza-community/eza/releases/latest/download/man-${EZA_VERSION}.tar.gz | tar xz ./target/man-${EZA_VERSION}/eza.1 --strip-components=3 && \ | ||
install eza /usr/local/bin && mv eza.1 /usr/local/share/man/man1 && rm eza && \ | ||
# Install MUSL delta from source | ||
DELTA_VERSION=$(curl -sL "https://api.github.com/repos/dandavison/delta/releases/latest" | grep tag_name | cut -d '"' -f4) && \ | ||
curl -sL https://github.com/dandavison/delta/releases/latest/download/delta-${DELTA_VERSION}-x86_64-unknown-linux-musl.tar.gz \ | ||
| tar xz delta-${DELTA_VERSION}-x86_64-unknown-linux-musl/delta --strip-components=1 && \ | ||
install delta /usr/local/bin && rm delta && \ | ||
# Install MUSL yazi from source | ||
YAZI_VERSION=$(curl -sL "https://api.github.com/repos/sxyazi/yazi/releases/latest" | grep tag_name | cut -d '"' -f4) && \ | ||
curl -sLo yazi.zip https://github.com/sxyazi/yazi/releases/download/${YAZI_VERSION}/yazi-x86_64-unknown-linux-musl.zip && \ | ||
unzip -qj yazi.zip yazi-x86_64-unknown-linux-musl/yazi && \ | ||
install yazi /usr/local/bin && rm yazi yazi.zip && \ | ||
# Install LINUX lazygit from source | ||
LAZYGIT_VERSION=$(curl -sL "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') && \ | ||
curl -sL https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz \ | ||
| tar xz lazygit && \ | ||
install lazygit /usr/local/bin && rm lazygit && \ | ||
# Install LINUX jq | ||
JQ_VERSION=$(curl -sL "https://api.github.com/repos/jqlang/jq/releases/latest" | grep tag_name | cut -d '"' -f4) && \ | ||
curl -sLo jq https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64 && \ | ||
curl -sL https://github.com/jqlang/jq/releases/latest/download/${JQ_VERSION}.tar.gz | tar xz ${JQ_VERSION}/jq.1 --strip-components=1 && \ | ||
install jq /usr/local/bin && mv jq.1 /usr/local/share/man/man1 && rm jq && \ | ||
# Install zoxide | ||
curl -sLS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash -s -- --bin-dir /usr/local/bin --man-dir /usr/local/share/man && \ | ||
RUN apk -q --no-progress --no-cache add sudo bash && \ | ||
# Create user | ||
addgroup --gid $USER_GID $USERNAME && \ | ||
# Set Zsh as the default shell | ||
|
@@ -83,64 +28,12 @@ RUN apk -q --no-progress --no-cache add \ | |
# Set default user | ||
USER $USERNAME | ||
WORKDIR $HOME | ||
# Setup dotfiles | ||
COPY --chown=$USERNAME:$USERNAME install.sh $HOME/install.sh | ||
COPY --chown=$USERNAME:$USERNAME tests /tmp/tests | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
# Bootstrap | ||
RUN \ | ||
# Create the top level directories before stowing so that stow does not symlink from the top level | ||
mkdir -p $HOME/.config/{nvim,tmux,yazi,zsh} $HOME/.vim && \ | ||
# Stow the dotfiles | ||
git clone -q --depth=1 https://github.com/mau-mauricelim/dotfiles.git $HOME/dotfiles && \ | ||
cd $HOME/dotfiles && git remote set-url origin [email protected]:mau-mauricelim/dotfiles.git && \ | ||
stow . && git restore . && cd $HOME && \ | ||
# Install local binaries | ||
sudo install $HOME/dotfiles/bin/* /usr/local/bin && \ | ||
# Create a symlink for zshenv to HOME | ||
ln -s $HOME/.config/zsh/.zshenv $HOME/.zshenv && \ | ||
# Source the latest zshenv | ||
source $HOME/.zshenv && \ | ||
# Create ZDOTDIR and XDG_DATA_HOME directories | ||
mkdir -p $ZDOTDIR $XDG_DATA_HOME/{nvim,vim}/{undo,swap,backup} && \ | ||
# Zsh Theme - Powerlevel10k (Requires manual font installation) | ||
git clone -q --depth=1 https://github.com/romkatv/powerlevel10k.git $ZDOTDIR/powerlevel10k && \ | ||
# Zsh Auto Suggestions | ||
git clone -q --depth=1 https://github.com/zsh-users/zsh-autosuggestions $ZDOTDIR/zsh-autosuggestions && \ | ||
# Zsh Syntax Highlighting | ||
git clone -q --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/zsh-syntax-highlighting && \ | ||
# fzf | ||
git clone -q --depth 1 https://github.com/junegunn/fzf.git $ZDOTDIR/fzf && \ | ||
$ZDOTDIR/fzf/install --xdg --no-update-rc --completion --key-bindings >/dev/null 2>&1 && \ | ||
# Vim syntax and indent | ||
mkdir -p $HOME/.vim/{indent,syntax} && \ | ||
git clone -q --depth=1 https://github.com/katusk/vim-qkdb-syntax.git $HOME/.vim/vim-qkdb-syntax && \ | ||
ln -s $HOME/.vim/vim-qkdb-syntax/indent/{k,q}.vim $HOME/.vim/indent && \ | ||
ln -s $HOME/.vim/vim-qkdb-syntax/syntax/k.vim $HOME/.vim/syntax && \ | ||
git clone -q --depth=1 https://github.com/jshinonome/vim-q-syntax.git $HOME/.vim/vim-q-syntax && \ | ||
ln -s $HOME/.vim/vim-q-syntax/syntax/q.vim $HOME/.vim/syntax && \ | ||
# Symlink Vim syntax and indent files to Neovim | ||
ln -s $HOME/.vim/indent $XDG_CONFIG_HOME/nvim && \ | ||
ln -s $HOME/.vim/syntax $XDG_CONFIG_HOME/nvim && \ | ||
# bash and zsh key bindings for Git objects, powered by fzf. | ||
curl -sLo $XDG_CONFIG_HOME/fzf/fzf-git.sh https://raw.githubusercontent.com/junegunn/fzf-git.sh/main/fzf-git.sh && \ | ||
# TPM installation | ||
# git clone -q --depth=1 https://github.com/tmux-plugins/tpm $XDG_CONFIG_HOME/tmux/plugins/tpm && $XDG_CONFIG_HOME/tmux/plugins/tpm/bin/install_plugins && \ | ||
# Install q language server for neovim | ||
sudo npm --global i @jo.shinonome/qls && \ | ||
# Install yazi themes | ||
git clone -q --depth=1 https://github.com/yazi-rs/flavors.git flavors && \ | ||
mkdir -p $XDG_CONFIG_HOME/yazi/flavors && \ | ||
mv flavors/*.yazi $XDG_CONFIG_HOME/yazi/flavors && rm -rf flavors && \ | ||
# Run Lazy install, clean and update non-interactively from command line | ||
# nvim --headless '+Lazy! sync' +qa && \ | ||
RUN bash install.sh $INSTALL_TYPE && rm install.sh && \ | ||
# Run tests | ||
source $HOME/.bashrc && \ | ||
echo -e "\n#########\n# TESTS #\n#########\n" && \ | ||
echo -e "\n#########\n# TESTS #\n#########\n" && \ | ||
for test in /tmp/tests/*.sh; do bash "$test"; done && \ | ||
rm -rf /tmp/tests && \ | ||
# Start zsh and exit (It'll allow powerlevel10k to do everything it needs to do on first run.) | ||
echo exit | script -qec zsh /dev/null >/dev/null && \ | ||
# Clean up | ||
sudo apk del util-linux-misc | ||
rm -rf /tmp/tests |
Oops, something went wrong.