An example of Docker multi-stage building with Golang
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
frame
Dockerfile
README.md
docker-multistage-build-HD.jpg
example.go

README.md

An example of Docker multi-stage building with Golang

Itwars multi-stage building Docker

Introduction

This repository is part of my blog post on Docker multistage builds.

Howto Docker multistage builds

To illustrate this purpose, I use a small golang app that write ascii colored output. It use a lib + a local package call myframe.go.

In the Dockerfile, first stage build the golang app binary, while second stage copy it into the final image for run purpose.

Bonus

As we produce a binary, I can make the second stage using the magic FROM scratch that allowed me to make a 2Mb tiny Docker image!