Containerize your Go application with Docker
Containerize your Go application with Docker
I am working on a small project with an API written in Go. After some time in development and testing was getting tired of building the binary and uploading it to a test server via SFTP, so I started to look for way putting the project in a container and deploying it with CI tools. More on the CI part in another post.
After some experiments I found that Jess Frazelle uses a Dockerfile like this for many projects with Go:
I think this is a great and simple solution. It creates a builder container with the Go compiler and builds the binary which gets packed into a small container for deployment.