瀏覽代碼

Merge branch 'develop'

master
Rohan Verma 6 年之前
父節點
當前提交
8c78b68eed
共有 2 個檔案被更改,包括 12 行新增10 行删除
  1. +10
    -8
      content/blog/2019/2019-11-05-docker-gopls.md
  2. +2
    -2
      content/blog/2019/2019-11-15-selfhosted-netlify.md

+ 10
- 8
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.

+ 2
- 2
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"
+++


Loading…
取消
儲存