Go projects and docker compose watch

<p><code>docker compose watch</code>&nbsp;(AKA hot reload)&nbsp;<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&rsquo;s a nice tool for automatic updating of running containers upon save.</p> <p>Something I haven&rsquo;t seen discussed much on the internet or from Googling is how to use it with a Go project, so I thought I&rsquo;d document how you can easily use it with yours.</p> <h1>Prerequisites</h1> <p>Make sure you have at least&nbsp;<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>&nbsp;or&nbsp;<a href="https://docs.docker.com/compose/install/standalone/" rel="noopener ugc nofollow" target="_blank">Docker Compose standalone 2.22.0</a>&nbsp;installed.</p> <h1>Steps</h1> <p><em>(I&rsquo;m assuming you have an existing Go project with a&nbsp;</em><code><em>main.go</em></code><em>&nbsp;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>
Tags: Docker Compose