From 7a6d92eef5e992915946b58b5818a2b65791392e Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Tue, 12 Mar 2019 14:35:47 +0000 Subject: Revert "Update to run as non root user" This reverts commit 12ff9f4c39e9fa79e1903b2c67ea2069f213b1be. --- README.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8927429..2679052 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,38 @@ # Dockerized Neovim -An exercise in masochism. In an effort to have a portable development neovim -setup and learn more about docker, I've put my entire neovim setup into a docker -container. To experiment with this image you can pull it from the [docker -hub][1] repository: +Run neovim in a container and be cool like all the other cool kids. I'm +currently trying to have as little dependancies installed on my host +machine as possible. -``` -$ docker pull thornycrackers/neovim -``` +# Step 1: Build the image + +The are 2 small steps that occur in this step. First we build the binaries +for shellcheck, because I want to only have couple of MB's in binaries vs +installing haskell. This creates a folder called 'package' at the root +directory which we then import to our main neovim image. The second step +is actually compiling the the neovim package which is just installing some +stuff and copying the binaries. This can all be done with a single make +command `make build` -### Running the image +# Step 2: Run the image + +Say you have a local file called 'test.php' and you are in the same +directory as the file. To open that file with the neovim container simply +run the following -The image is setup internally to uid `1000`. You can check your user id with -`id -u` and if your id is different than `1000` you will have to build the -container yourself (e.g. change the `1000` numbers to your id and run `make -build`). If you want to try creating a file, say `test.txt` you could run the -following command: ``` -$ docker run -i -t -v $(pwd):/src thornycrackers/neovim /bin/bash -c 'nvim /src/test.txt' +$ docker run -i -t -v $(pwd):/src thornycrackers/neovim /bin/sh -c 'nvim /src/test.php' ``` -After you exit the neovim container your host should have the `test.txt` file -with the correct user permissions +This will open up neovim and when you exit neovim it will exit the container. # Step 3: Make this command a little more useful So using that command is awesome but a little cumbersome everytime you -want to run it against a different file. Create a file called `nvim` and +want to run it against a different file. Create a file called 'nvim' and make sure to give it executable permissions and place it somewhere in your -$PATH. Copy the following inside of the `nvim` executable file(make sure to -chmod +x the file) +$PATH. Copy the following inside of the 'nvim' executable file. ``` #!/bin/bash @@ -45,11 +47,11 @@ else fi # Run the docker command -docker run -i -t -P -v "$dir_name":/src thornycrackers/neovim /bin/sh -c "cd /src; nvim $file_name" +docker run -i -t -P -v "$dir_name":/src thornycrackers/neovim /bin/sh -c "cd /src;nvim $file_name" ``` Now you can run neovim as if you would regularly. The only gotcha I've -discovered so far is that because you are mounting to the docker +deiscovered so far is that because you are mounting to the docker container you cannot go above the folder you open neovim in. This is a pretty rare case in my trials of using this but it is something to note. @@ -57,5 +59,3 @@ a pretty rare case in my trials of using this but it is something to note. I do set the git identity to myself inside the Dockerfile so be aware that you might want to change it to yourself. - -[1]: https://hub.docker.com/r/thornycrackers/neovim -- cgit v1.2.3