This is a demo of some capabilities of Multi-stage Docker builds.
The core of the demo is a simple Express server running on http://localhost/3000. Start it like this so that you can observe Docker's build process:
`docker compose up --build`
The commits tell the story of how this this demo app grew and what Docker features were used along the way. You can git checkout
any of the various tagged commits and run docker compose up --build
to see what difference each change set makes. There are also additional comments in Dockerfile, .dockerignore, and compose.yml.
To test your understanding, here are some questions:
- After adding the
tests
stage, thebuild
stage now runs when tests change. How can you make that not be the case? - What would be the pros and cons of moving tests into a nested package, like the server?