Closed charypar closed 7 years ago
It looks like Docker Hub doesn't support multi-stage builds just yet :( https://hub.docker.com/r/charypar/swarm-dashboard/builds/b6ql9kh27r7as8yexpmdnxd/
Here's an issue tracking it https://github.com/docker/hub-feedback/issues/1039, the gist is Docker Hub runs Docker EE, which doesn't have a 17.06 release yet.
Well, Docker Cloud works :)
Resolves #8.
The original docker image was relatively large for what it did. This reduces the size from 249 MB to 68.7 MB by using a multi-stage build, switching to Alpine Linux based Node 8 base image for runtime and removing Babel entirely (except for parsing in eslint).
Note that the Elm compilation stage still uses node:6-slim, as the npm installer fails on all other base images I tried (:6-alpine, :8-alpine, :8-slim). Not sure why... Fortunately, thanks to multi-stage builds and only using the compiled output, it doesn't matter.
Here are the image layers:
Original - node:6-slim - 294MB
node-8:alpine + multi-stage build - 82.6MB
node-8:alpine + multi-stage build + no Babel - 68.7MB