aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpml68 <contact@pml68.me>2024-11-25 00:35:44 +0100
committerpml68 <contact@pml68.me>2024-11-25 00:44:06 +0100
commit9d50bd8efcc2683b5b0ac6b2a914c219ee212360 (patch)
tree7c6ede393ecde0d6ec6d7266d26563d7e151bc8d
parentfeat: add java support (diff)
downloadnvim-9d50bd8efcc2683b5b0ac6b2a914c219ee212360.tar.gz
feat: add Dockerfile for building docker image
Diffstat (limited to '')
-rw-r--r--.bashrc75
-rw-r--r--Dockerfile61
-rw-r--r--README.md14
3 files changed, 150 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
new file mode 100644
index 0000000..6a9066e
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,75 @@
+#
+# ~/.bashrc
+#
+
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
+export CPPFLAGS="-Wall -Weffc++ -Wextra -Werror -Wconversion -Wsign-conversion -pedantic-errors -std=gnu++2b -fmodules-ts"
+export EDITOR=nvim
+export HISTSIZE=1000
+export HISTFILESIZE=2000
+export TERM=xterm-256color
+
+YELLOW="\[$(tput setaf 3)\]"
+GREEN="\[$(tput setaf 2)\]"
+RED="\[$(tput setaf 1)\]"
+BLUE="\[$(tput setaf 4)\]"
+RESET="\[$(tput sgr0)\]"
+
+avg_time() {
+ #
+ # usage: avg_time n command ...
+ #
+ n=$1; shift
+ (($# > 0)) || return # bail if no command given
+ for ((i = 0; i < n; i++)); do
+ { time -p "$@" &>/dev/null; } 2>&1 # ignore the output of the command
+ # but collect time's output in stdout
+ done | awk '
+ /real/ { real = real + $2; nr++ }
+ /user/ { user = user + $2; nu++ }
+ /sys/ { sys = sys + $2; ns++}
+ END {
+ if (nr>0) printf("real %f\n", real/nr);
+ if (nu>0) printf("user %f\n", user/nu);
+ if (ns>0) printf("sys %f\n", sys/ns)
+ }'
+}
+
+alias grep='grep --color=auto'
+alias eza='eza --icons'
+alias tree='eza --tree'
+alias fvim='nvim $(fzf)'
+alias c='clear'
+alias diff='diff --color -up'
+alias oil='~/.oil-ssh.sh'
+
+parse_git_bg() {
+ if [[ $(git status -s 2> /dev/null) ]]; then
+ tput setaf 160
+ else
+ tput setaf 34
+ fi
+}
+
+PS1="╭─${YELLOW}"
+PS1+="\u${GREEN}"
+PS1+="@${RED}"
+PS1+="\h${BLUE} "
+PS1+="\W${RESET}"
+PS1+="\$(git branch 2> /dev/null | grep '^*' | colrm 1 2 | xargs -I BRANCH echo -n \""
+PS1+="\$(parse_git_bg) "
+PS1+=" (BRANCH) "
+PS1+="${RESET}\")\n"
+PS1+="╰─"
+PS1+="\\$ "
+PS1+="${RESET}"
+export PS1
+
+export FZF_DEFAULT_OPTS="
+ --color=fg:#908caa,bg:#191724,hl:#ebbcba
+ --color=fg+:#e0def4,bg+:#26233a,hl+:#ebbcba
+ --color=border:#403d52,header:#31748f,gutter:#191724
+ --color=spinner:#f6c177,info:#9ccfd8,separator:#403d52
+ --color=pointer:#c4a7e7,marker:#eb6f92,prompt:#908caa"
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..64da700
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,61 @@
+FROM alpine:edge AS base
+WORKDIR /root
+SHELL ["/bin/sh", "-c"]
+
+RUN apk add --no-cache git \
+ lazygit \
+ neovim \
+ man-pages \
+ alpine-sdk \
+ bash \
+ eza \
+ ncurses \
+ util-linux-misc \
+ curl \
+ --update
+
+# install deps needed by neovim
+RUN apk add --no-cache wget \
+ gzip \
+ neovim-doc \
+ ripgrep \
+ rust \
+ python3 \
+ openjdk21 \
+ openjdk17 \
+ gradle \
+ dotnet8-sdk \
+ clang19-extra-tools \
+ nodejs \
+ npm
+
+# install TeX
+RUN apk add --no-cache texlive \
+ texlive-binextra \
+ texmf-dist-fontsextra \
+ texmf-dist-fontutils \
+ texmf-dist-fontsrecommended \
+ texmf-dist-formatsextra \
+ texmf-dist-langenglish \
+ texmf-dist-langeuropean \
+ texmf-dist-latexextra \
+ texmf-dist-latexrecommended \
+ texmf-dist-pictures \
+ texmf-dist-plaingeneric
+
+# pre-download lazy.nvim
+RUN git clone --filter=blob:none https://github.com/folke/lazy.nvim.git --branch=stable /root/.local/share/nvim/lazy/lazy.nvim
+
+# copy config files
+COPY .bashrc .bashrc
+COPY . .config/nvim
+
+FROM base
+SHELL ["/bin/bash", "-c"]
+WORKDIR /root
+RUN nvim --headless +"Lazy! sync" +qa; exit 0
+
+# symlink the clangd executable, since it can't be installed with mason
+RUN ln -sf /usr/bin/clangd /root/.local/share/nvim/mason/bin/clangd
+
+CMD ["/bin/bash"]
diff --git a/README.md b/README.md
index 8a01b34..ad22f07 100644
--- a/README.md
+++ b/README.md
@@ -9,3 +9,17 @@ Download into your config directory
```sh
git clone --depth=1 https://github.com/pml68/nvim-setup ~/.config/nvim
```
+
+## Usage with Docker
+
+Build the image
+```sh
+docker build -t neovim .
+```
+
+And then run it
+```sh
+docker run -it neovim:latest bash
+```
+
+The image size is somewhere around 5.9GB due to every language I use being included (C# with .NET, Java 21 and 17 etc.)