DEV Community

Niklas Merz
Niklas Merz

Posted on • Originally published at blog.merzlabs.com on

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.

Top comments (1)

Collapse
 
shostarsson profile image
Rémi Lavedrine

That is a very interesting post.
I have developed something using Go and I would give it a try.
I have never used Docker yet, but I think that it could a good start project to learn Docker. 😄