In this lesson, you’ll learn how to set up a containerized development environment that rebuilds your Go code automatically as you edit your code.
If you put your Go code in containers, there are two build steps: compiling the code itself, and then building the executable (and any dependencies) into a container. In this lesson we see how you can use tools such as Realize to automatically rebuild your code, even within a container. We also look at how to generate a small and efficient container image for production distribution using Docker Multistage Builds.
This lesson is for you if you’re a Go programmer who is considering how to introduce Docker containers into your workflow—or you’re already bored of typing
Here are some things that you should have under your belt before going ahead with this lesson:
You should be comfortable with the command line
You should have a file editor that you like
You are happy compiling Go executables by using
Before we get started, make sure you:
Containers give you a really convenient way to package your code and ensure that you have the same dependencies and environment wherever you run it—whether it’s in production or on a teammate’s laptop. But during the development process, containers can seem like an extra, unnecessary step, especially for Go programmers. ...