From c1314b4546008d27d1c2ec92fd0de1cb8a291e3c Mon Sep 17 00:00:00 2001 From: Rohan Verma Date: Mon, 18 Nov 2019 12:30:10 +0530 Subject: [PATCH] fix: minor bash changes in commands --- content/blog/2019/2019-11-05-docker-gopls.md | 18 ++++++++++-------- .../blog/2019/2019-11-15-selfhosted-netlify.md | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/content/blog/2019/2019-11-05-docker-gopls.md b/content/blog/2019/2019-11-05-docker-gopls.md index 7e00f38..928fc8a 100644 --- a/content/blog/2019/2019-11-05-docker-gopls.md +++ b/content/blog/2019/2019-11-05-docker-gopls.md @@ -71,7 +71,9 @@ CMD /home/myuser/go/bin/gopls -listen=":7050" ``` Firstly, we install all the dependencies and then create -a user which will have access to the source code. +a user which will have access to the source code. We pass +the same user ID as our host user by using the MY_USER_ID +as the build argument. Then we have to replicate the host path in the container and set that as our work directory. This is a quirk @@ -88,8 +90,8 @@ We will now build the image. mkdir -p go docker build \ ---build-arg MY_PWD=${PWD} \ ---build-arg=MY_USER_ID=${MY_USER_ID} \ +--build-arg MY_PWD=$PWD \ +--build-arg=MY_USER_ID=`id -u $USER` \ -t myapp:latest . ``` @@ -100,10 +102,10 @@ Now we can expose this port to our host machine. ```bash docker run -d --name "myapp" \ --u `id -u ${USER}` \ --e "GOPATH=${PWD}/go" \ +-u `id -u $USER` \ +-e "GOPATH=$PWD/go" \ -p 7050:7050 \ --v ${PWD}:${PWD} myapp:latest +-v $PWD:$PWD myapp:latest ``` Notice, that we also mount the host source in the container with the same path, @@ -130,8 +132,8 @@ For VSCode, you can add the following to your `settings.json` ``` After adding this flag, you will now be able to edit your source with all the -added benefits that come with a language server like autocompletion and -autoformatting. +added benefits that come with a language server like auto completion and +auto formatting. Since this is an experimental feature, it might break (a lot). Do let me know in the comments if this was helpful for you. \ No newline at end of file diff --git a/content/blog/2019/2019-11-15-selfhosted-netlify.md b/content/blog/2019/2019-11-15-selfhosted-netlify.md index 6cb36eb..7e58019 100644 --- a/content/blog/2019/2019-11-15-selfhosted-netlify.md +++ b/content/blog/2019/2019-11-15-selfhosted-netlify.md @@ -1,11 +1,11 @@ +++ title = "Self hosted Netlify using docker-compose, gitea, and drone-ci" -date = 2019-11-15T15:30:03+05:30 +date = 2019-11-16T15:30:03+05:30 draft = true tags = ["golang", "docker", "self hosted"] categories = ["tutorials"] type = "post" -url = "blog/2019/11/15/selfhosted-netlify" +url = "blog/2019/11/16/selfhosted-netlify" author = "Rohan Verma" +++