Skip to content

Commit

Permalink
add manual docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodal98 committed Nov 27, 2022
1 parent e68426a commit 723cd46
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plugin
2 changes: 2 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ if [[ "$BRANCH" != "master" ]]; then
fi

files=(
"Dockerfile"
".dockerignore"
".githooks"
".gitignore"
"init.lua"
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine:edge

COPY . /root/.config/nvim

WORKDIR /project

RUN apk --no-cache add git neovim bash nodejs npm ripgrep alpine-sdk shfmt black py3-pip && \
npm install -g pyright bash-language-server dockerfile-language-server-nodejs prettier @fsouza/prettierd && \
pip install proselint

ENTRYPOINT ["bash"]
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,36 @@ mkdir -p ~/.local/share/nvim && rm -r ~/.local/share/nvim
git clone https://github.com/jrodal98/nvim ~/.config/nvim
```

## Docker

### Build instructions

First, build a base image

```
docker build . -t ghcr.io/jrodal98/nvim:<version>
```

Next, run a container

```
docker run -it --rm --name nvim_docker_base ghcr.io/jrodal98/nvim:<version>
```

Finally, we must manually complete the build, due to issues with running packer headless.

1. Run `nvim`, which will trigger the initial packersync (you may see errors - this is okay)
2. Close nvim and then run `nvim` again
3. Wait for all the treesitter and mason LSP configs to download
4. Outside of the container, open another terminal and run this to save the image: `docker container commit --change='ENTRYPOINT ["/usr/bin/nvim"]' nvim_docker_base ghcr.io/jrodal98/nvim:<version>`

To upload it to ghcr without a github action...

1. `docker login ghcr.io`
2. enter github username and access token
4. `docker tag ghcr.io/jrodal98/nvim:<version> ghcr.io/jrodal98/nvim:latest`
5. `docker push ghcr.io/jrodal98/nvim:latest`

## Inspiration

- [nvim-basic-ide](https://github.com/LunarVim/nvim-basic-ide)
Expand Down

0 comments on commit 723cd46

Please sign in to comment.