A multi-container Dockerfile for acs-engine

I was looking for a way to create different versions of the amazing acs-engine project and I came up with a simple Dockerfile that uses multi-stage build. This way, the final docker container is only 51Mb!

The Dockerfile I used is this:

You don’t need to checkout https://github.com/Azure/acs-engine, and you can change the Dockerfile to pointing to a fork of acs-engine. Unfortunately, go get doesn’t support checking out a specific branch, so I left commented out a RUN statement that does just that before building.

After the build, the go binary is handed over to a much smaller and leaner container (and the golang container thrown away). Build and push as:

docker build -t ams0/acs-engine-light  .
docker push ams0/acs-engine-light

So, how do I use this thing?

Well, that’s easy. Build your own container or use mine, and set an alias like:

alias acse='docker run -it --rm -v `pwd`:/acs -w /acs ams0/acs-engine-light /acs-engine'

Now use it like there’s no tomorrow:

acse generate template.json

I also made a convenient script at https://github.com/ams0/acs-engine-light/blob/master/deployk8s.sh that, if you use some variable substitution like in the included kubernetes.json file, can avoid the use of (and associated inadvertent commit to github, ehm..) service principals in your templates.