TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Go, Docker workflow

32 点作者 johannesboyne将近 10 年前

4 条评论

rcarmo将近 10 年前
That Makefile is... weird. Why issue a &quot;make sub-target&quot; command? Makefiles are all about understanding dependencies, so you should actually be doing<p><pre><code> target: dependency &lt;commands&gt; </code></pre> ...instead of<p><pre><code> target: make dependency &lt;commands&gt; </code></pre> Doing it this way actually breaks dependency checks. It&#x27;s just plain wrong.<p>Here&#x27;s a &quot;proper&quot; Makefile, complete with conditionals, expansion, etc.:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rcarmo&#x2F;sushy&#x2F;blob&#x2F;master&#x2F;Makefile" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rcarmo&#x2F;sushy&#x2F;blob&#x2F;master&#x2F;Makefile</a><p>...and here&#x27;s one of my Go Makefiles (no sub-targets here, but does vendoring in a way that&#x27;s quite similar to what Go 1.5 turned out to adopt)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rcarmo&#x2F;go-rss2imap&#x2F;blob&#x2F;master&#x2F;Makefile" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rcarmo&#x2F;go-rss2imap&#x2F;blob&#x2F;master&#x2F;Makefile</a><p>(edit: whitespace)
评论 #9818485 未加载
评论 #9817529 未加载
olalonde将近 10 年前
Worth checking out docker-compose for more complex setups (if you need a Redis and PostgreSQL database running for example). I have been using it for Node.js development for the past few months and it is really a life changer especially if you are working on multiple projects concurrently. Pro-tip: `echo &quot;alias dc=docker-compose&quot; &gt;&gt; ~&#x2F;.zshrc`
评论 #9817522 未加载
评论 #9817493 未加载
评论 #9817553 未加载
vieux将近 10 年前
Why &quot;FROM tianon&#x2F;true&quot; ? &quot;FROM scratch&quot; would be even smaller. That&#x27;s what we use in the docker swarm image: <a href="https:&#x2F;&#x2F;github.com&#x2F;docker&#x2F;swarm-library-image&#x2F;blob&#x2F;master&#x2F;Dockerfile" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;docker&#x2F;swarm-library-image&#x2F;blob&#x2F;master&#x2F;Do...</a>
keegancsmith将近 10 年前
An improvement I&#x27;d make to this is not sending the current directory to docker, but rather a directory containing just the binary. That way you don&#x27;t send a massive context to docker which you just throw away. (Especially in go projects which vendor in a lot of dependencies)