Docker Setup For Go With Makefile

Posted on March 10, 2019

Why Docker

My goal for 2019 has primarily been to deploy code without servers. Why?

I work on a small team. And anytime we spend worrying about something other than business logic is a waste of time.

We currently have some good automated processes in place for Serverless repos. But, our main business logic is still driven by Elastic Beanstalk.

This talk by Kelsey Hightower insired me to take Docker & Kubernetes futher than we had currently be using them.

Deployment Is Pushing To Git

The primary thing I took away from the talk was that for your team to be the most productive, deployment should simply mean pushing to Github.

We’re most of the way there already. But, I think by futher embracing Docker and some AWS services like ECS/ECR we can even most abstract the management of individual servers.

Containers

My Go Repo

So, I’m diving head first into writing Dockerfile’s from scratch. And then deploying them to ECS.

Yesterday, I got a simply hello-world app up on ECS. Today, I focused on creating a Makefile that abstracts away the commands even further.

There is still a lot to be done in this repo. But, I think it’s the starting point for eventually having one Makefile/Dockerfile that eventually just takes in some flags for env variables, repo locations, and ports. And then builds an image, pushes the image, and deploys itself to ECS.

The Makefile is the main thing I’m focused on here.

Once you can easily develop Go with dependencies and everything inside of a Docker Container on your local, it becomes really easy to turn it into an image, tag it, and upload it to AWS.

My goal is to make this process super simple. And then make one shared repository like Kelsey did in that video that drives all deployments versioning.

From here, it should be simple to develop locally, push to git, and have ECS take over from there.

Example Repo

Containers again