Go projects and docker compose watch
<p><code>docker compose watch</code> (AKA hot reload) <a href="https://www.docker.com/blog/announcing-docker-compose-watch-ga-release/" rel="noopener ugc nofollow" target="_blank">is now available to everyone</a>. It’s a nice tool for automatic updating of running containers upon save.</p>
<p>Something I haven’t seen discussed much on the internet or from Googling is how to use it with a Go project, so I thought I’d document how you can easily use it with yours.</p>
<h1>Prerequisites</h1>
<p>Make sure you have at least <a href="https://www.docker.com/blog/docker-desktop-4-24-compose-watch-resource-saver-and-docker-engine/" rel="noopener ugc nofollow" target="_blank">Docker Desktop 4.24</a> or <a href="https://docs.docker.com/compose/install/standalone/" rel="noopener ugc nofollow" target="_blank">Docker Compose standalone 2.22.0</a> installed.</p>
<h1>Steps</h1>
<p><em>(I’m assuming you have an existing Go project with a </em><code><em>main.go</em></code><em> in the root. You may need to adjust this setup some for your specific needs)</em></p>
<p><a href="https://lukerogerson.medium.com/go-projects-and-docker-compose-watch-e98af8c497bf"><strong>Click Here</strong></a></p>