mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-17 19:36:28 +00:00
Add support for running in a Docker image
This commit is contained in:
parent
0a7865275f
commit
19d082d26d
18
.dockerignore
Normal file
18
.dockerignore
Normal file
@ -0,0 +1,18 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
.pre_commit_env/
|
||||
tags
|
||||
vim/.netrwhist
|
||||
vim/UltiSnips
|
||||
vim/autoload/plug.vim
|
||||
vim/autoload/plug.vim.old
|
||||
vim/backup/
|
||||
vim/plugged/
|
||||
vim/rc/*.local.rc.vim
|
||||
vim/rc/plugins/*.local.rc.vim
|
||||
vim/spell/
|
||||
vim/tmp/
|
||||
vim/tmp/viminfo.*
|
||||
vim/view/
|
||||
Dockerfile
|
||||
Makefile
|
80
Dockerfile
Normal file
80
Dockerfile
Normal file
@ -0,0 +1,80 @@
|
||||
FROM ubuntu:hirsute
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
bash \
|
||||
curl \
|
||||
git \
|
||||
golang \
|
||||
gopls \
|
||||
make \
|
||||
neovim \
|
||||
npm \
|
||||
python3-autopep8 \
|
||||
python3-flake8 \
|
||||
python3-mypy \
|
||||
python3-neovim \
|
||||
python3-pip \
|
||||
python3-proselint \
|
||||
python3-pyls-black \
|
||||
python3-venv \
|
||||
universal-ctags \
|
||||
yamllint \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -ms /bin/bash vividboarder
|
||||
|
||||
RUN mkdir -p /go/bin
|
||||
ENV PATH $PATH:/go/bin
|
||||
RUN GOPATH=/go go get -u github.com/davidrjenni/reftools/cmd/fillstruct@master \
|
||||
&& GOPATH=/go go get -u github.com/fatih/gomodifytags@latest \
|
||||
&& GOPATH=/go go get -u github.com/fatih/motion@latest \
|
||||
# && GOPATH=/go go get -u github.com/go-delve/delve/cmd/dlv@latest \
|
||||
&& GOPATH=/go go get -u github.com/josharian/impl@master \
|
||||
&& GOPATH=/go go get -u github.com/jstemmer/gotags@master \
|
||||
&& GOPATH=/go go get -u github.com/kisielk/errcheck@latest \
|
||||
&& GOPATH=/go go get -u github.com/klauspost/asmfmt/cmd/asmfmt@latest \
|
||||
&& GOPATH=/go go get -u github.com/koron/iferr@master \
|
||||
&& GOPATH=/go go get -u github.com/rogpeppe/godef@latest \
|
||||
&& GOPATH=/go go get -u golang.org/x/lint/golint@master \
|
||||
&& GOPATH=/go go get -u golang.org/x/tools/cmd/goimports@master \
|
||||
&& GOPATH=/go go get -u golang.org/x/tools/cmd/gorename@master \
|
||||
&& GOPATH=/go go get -u golang.org/x/tools/cmd/guru@master \
|
||||
&& GOPATH=/go go get -u honnef.co/go/tools/cmd/keyify@master \
|
||||
&& GOPATH=/go go get -u honnef.co/go/tools/cmd/staticcheck@latest \
|
||||
&& GOPATH=/go go get -u github.com/mrtazz/checkmake \
|
||||
&& rm -fr /go/src /go/pkg
|
||||
|
||||
RUN pip install --no-cache-dir \
|
||||
reorder-python-imports \
|
||||
vim-vint
|
||||
|
||||
RUN npm install -g \
|
||||
alex \
|
||||
bash-language-server \
|
||||
csslint \
|
||||
|
||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /go/bin v1.35.2
|
||||
# RUN GOPATH=/go go get -u github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
USER vividboarder
|
||||
VOLUME /home/vividboarder
|
||||
WORKDIR /home/vividboarder
|
||||
ENV HOME /home/vividboarder
|
||||
ENV XDG_CONFIG_HOME $HOME/.config
|
||||
RUN mkdir -p $XDG_CONFIG_HOME
|
||||
|
||||
COPY --chown=vividboarder:vividboarder . /vim-settings
|
||||
|
||||
# RUN ln -s $HOME/settings/vim "$XDG_CONFIG_HOME/nvim"
|
||||
# RUN ln -s $HOME/settings/vim "$HOME/.vim"
|
||||
# RUN ln -s $HOME/settings/vim/init.vim "$HOME/.vimrc"
|
||||
|
||||
ENV NPM_PACKAGES $HOME/.npm-packages
|
||||
# RUN mkdir $NPM_PACKAGES
|
||||
RUN npm config set prefix $NPM_PACKAGES
|
||||
ENV PATH $PATH:$NPM_PACKAGES
|
||||
ENV PATH $HOME/.local/bin:$PATH
|
||||
# RUN ./settings/install-language-servers.sh
|
||||
|
||||
RUN mkdir data
|
25
Makefile
25
Makefile
@ -45,3 +45,28 @@ install-hooks: $(PRE_COMMIT_ENV_BIN)/pre-commit
|
||||
.PHONY: check
|
||||
check: $(PRE_COMMIT_ENV_BIN)/pre-commit
|
||||
$(PRE_COMMIT_ENV_BIN)/pre-commit run --all-files
|
||||
|
||||
# Build Docker images
|
||||
.PHONY: docker-build
|
||||
docker-build:
|
||||
docker build \
|
||||
--tag vividboarder/my-neovim .
|
||||
|
||||
# Build Docker images
|
||||
.PHONY: docker-build-all
|
||||
docker-build-all:
|
||||
docker buildx build \
|
||||
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
|
||||
--tag vividboarder/my-neovim .
|
||||
|
||||
# Build Docker images
|
||||
.PHONY: docker-build-push
|
||||
docker-build-push:
|
||||
docker buildx build \
|
||||
--push \
|
||||
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
|
||||
--tag vividboarder/my-neovim .
|
||||
|
||||
.PHONY: docker-clean
|
||||
docker-clean:
|
||||
docker volume rm nvim-$(USER)-home
|
||||
|
16
docker-entry.sh
Executable file
16
docker-entry.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
VIM_SYNC_DIR=$HOME/vim-settings
|
||||
# copy settings to volume
|
||||
[ -d "$VIM_SYNC_DIR" ] || cp -r /vim-settings "$VIM_SYNC_DIR"
|
||||
|
||||
# Link config files
|
||||
[ -d "$XDG_CONFIG_HOME" ] || mkdir -p "$XDG_CONFIG_HOME"
|
||||
[ -d "$XDG_CONFIG_HOME/nvim" ] || ln -s "$VIM_SYNC_DIR/vim" "$XDG_CONFIG_HOME/nvim"
|
||||
[ -d "$XDG_CONFIG_HOME/nvim/backup" ] || mkdir -p "$XDG_CONFIG_HOME/nvim/backup"
|
||||
[ -d "$HOME/.vim" ] || ln -s "$VIM_SYNC_DIR/vim" "$HOME/.vim"
|
||||
[ -f "$HOME/.vimrc" ] || ln -s "$VIM_SYNC_DIR/vim/init.vim" "$HOME/.vimrc"
|
||||
|
||||
exec "$@"
|
22
nvim-container.sh
Executable file
22
nvim-container.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
|
||||
if ! docker image ls -q nvim > /dev/null ;then
|
||||
echo "no nvim image found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
container_name=nvim-$USER
|
||||
|
||||
if ! docker inspect "${container_name}-home" > /dev/null ; then
|
||||
docker volume create "${container_name}-home"
|
||||
fi
|
||||
|
||||
docker run --interactive --rm --tty \
|
||||
--name "$container_name" \
|
||||
--env "VIM_COLOR=$VIM_COLOR" \
|
||||
--volume "${container_name}-home:/home/vividboarder" \
|
||||
--volume "$(pwd):/home/vividboarder/data" \
|
||||
--workdir /home/vividboarder/data \
|
||||
--entrypoint /vim-settings/docker-entry.sh \
|
||||
vividboarder/my-neovim nvim "$@"
|
||||
# --user "$(id -u):$(id -g)" \
|
Loading…
Reference in New Issue
Block a user