Examples of how to use multistage docker builds to construct small production images
These examples are from the blog post All the small things.
Here we have a minimal Flask application.
Thicc:
$ cd python-example
$ docker build -t python-thicc -f Dockerfile_thicc .
Slim:
$ cd python-example
$ docker build -t python-slim -f Dockerfile_slim .
Thicc:
$ docker run --rm -p 4000:4000 python-thicc
Slim:
$ docker run --rm -p 4000:4000 python-slim
A Spring Boot HTTP JSON API generated from the Petstore Swagger example and modified to use Java 11.
Thicc:
$ cd java-example
$ docker build -t java-thicc -f Dockerfile_thicc .
Slim:
$ cd java-example
$ docker build -t java-slim -f Dockerfile_slim .
Thicc:
$ docker run --rm -p 8080:8080 java-thicc
Slim:
$ docker run --rm -p 8080:8080 java-slim
A HTTP JSON API generated from the Petstore Swagger example.
Thicc:
$ cd go-example
$ docker build -t go-thicc -f Dockerfile_thicc .
Slim:
$ cd go-example
$ docker build -t go-slim -f Dockerfile_slim .
Thicc:
$ docker run --rm -p 5000:5000 go-slim
Slim:
$ docker run --rm -p 5000:5000 go-slim
A React-based, single-page web application.
Thicc:
$ cd js-example
$ docker build -t js-thicc -f Dockerfile_thicc .
Slim:
$ cd js-example
$ docker build -t js-slim -f Dockerfile_slim .
Thicc:
$ docker run --rm -p 5000:5000 js-thicc
Slim:
$ docker run --rm -p 5000:80 js-slim