Develop Go package on docker container

polaris · · 495 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I do not have Go installed on my computer. I have set up a docker container for my package project. What is the best approach to develop custom package/lib on docker container ? Debug, build etc. ?</p> <p>Example <a href="https://raw.githubusercontent.com/vardius/goserver/master/docker-compose.yml" rel="nofollow">docker-compose.yml</a> file and <a href="https://raw.githubusercontent.com/vardius/goserver/master/cmd.sh" rel="nofollow">cmd.sh</a></p> <p>Full <a href="https://github.com/vardius/goserver" rel="nofollow">github</a></p> <p>Any tips ?</p> <hr/>**评论:**<br/><br/>itsmontoya: <pre><p>Why develop within a container? Seems like more work than necessary.</p></pre>vardius-: <pre><p>I just don&#39;t want to install Go on computer I am using </p></pre>itsmontoya: <pre><p>Why though? You haven&#39;t provided a good reason of why. Instead you come up with a convoluted development cycle.</p></pre>vardius-: <pre><p>It is not my computer and i do not have permission to install new stuff, docker is installed thought</p></pre>itsmontoya: <pre><p>In that case, setup a docker image as if it&#39;s a fresh dev box. You&#39;re sure the computer doesn&#39;t have QEMU or some other VM software?</p></pre>broady: <pre><p>Just download the binary release and untar/unzip it onto disk. It&#39;s not really &#34;installing new stuff&#34;. You can do far more damage with access to Docker.</p></pre>vardius-: <pre><p>I probably could install go on this local machine but i want to know if this is a good conf for docker development</p></pre>Tikiatua: <pre><p>Hi there,</p> <p>We developed a special docker container exactly for that and use it on a daily basis. </p> <p>The big advantage is, that you are absolutely certain which version of go you are using and you can use the docker network functionality to easily connect to database containers or services in other containers.</p> <p>We usually vendor our dependencies to be included in the project, but you can also use docker volumes to make packages from your go path available in the docker container.</p> <p>Check out the project at <a href="https://github.com/dkfbasel/hot-reload" rel="nofollow">https://github.com/dkfbasel/hot-reload</a>. The name of the container is dkfbasel/hot-reload-go:1.8.0.</p></pre>vardius-: <pre><p>the point is this is a custom lib package, so by itself it is not meant to run as a http server, and I would like to set up container for such lib development, with remote debugging</p></pre>njetten: <pre><p>Don&#39;t.</p> <p>Docker containers are supposed to be stateless, designed to just destroy and create a new one. If you don&#39;t have permissions to install stuff in the advised directories and/or don&#39;t want to, use a custom location [1]</p> <p>[1] <a href="https://golang.org/doc/install#install" rel="nofollow">https://golang.org/doc/install#install</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

495 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传