Sign inSign up

rackerlabs/whoa

By rackerlabs

•Updated about 11 years ago

Image
0

833

rackerlabs/whoa repository overview

⁠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 šŸŽ?

Tag summary

Content type

Image

Digest

sha256:342998585…

Size

1.2 MB

Last updated

about 11 years ago

docker pull rackerlabs/whoa