deis/deis — pull request #1851 by mboersma (2014-09-16 22:10:05+00:00)
Title: ref(router): optimize Dockerfile for smaller image

Builds nginx 1.6.1 from source, discarding the build tools afterward. Reduces the virtual size from 368MB to 180MB, at the cost of increased time for iterative development. Refs #1825, #1850.

```console
$ # worst-case build times: no local docker layers
$ time docker build -t deis/router:optimize .
Sending build context to Docker daemon 27.65 kB
...
Removing intermediate container 915cac6ddc8e
Successfully built a8f29a230fc8

real	2m29.080s
user	0m0.064s
sys	0m0.058s
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ time docker build -t deis/router:master .
Sending build context to Docker daemon 26.62 kB
...
Successfully built 7fed8dc2880c

real	3m27.248s
user	0m0.101s
sys	0m0.076s
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
deis/router master 7fed8dc2880c 29 minutes ago 367.9 MB
deis/router optimize a8f29a230fc8 34 minutes ago 180.4 MB
ubuntu 12.04 c17f3f519388 12 days ago 106.7 MB
deis/base latest 589b5b05090d 5 weeks ago 218.2 MB
```