Public | Automated Build

Last pushed: 2 years ago
Short Description
foo
Full Description

whoa

Simple Go binary -> tiny Docker image

$ ID=$( docker run -d -p 80:8080 rackerlabs/whoa )
$ curl $( docker port $ID 8080 )
šŸŽ‰  Whoa!  šŸŽ‰

Building

You'll need go with cross compiling support (and make)!

$ make

Background

The whoa binary that gets built is built specifically to be small, courtesy
@kelseyhightower.

$ CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' .

Assuming everything is happy in go land, that should create a whoa binary.

The Dockerfile relies on the super tiny scratch image,
adding the whoa server as one of its steps:

FROM scratch
EXPOSE 8080
ADD whoa /whoa
ENTRYPOINT ["/whoa"]

The resulting Docker image is < 5 MB:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
rackerlabs/whoa     latest              5ad725856153        About an hour ago   4.437 MB

How 'bout them :apple:?

Docker Pull Command
Owner
jamiehannafordtest
Source Repository

Comments (0)