TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Go, Docker workflow

32 pointsby johannesboynealmost 10 years ago

4 comments

rcarmoalmost 10 years ago
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 未加载
olalondealmost 10 years ago
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 未加载
vieuxalmost 10 years ago
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>
keegancsmithalmost 10 years ago
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)