This is an SPA+Docker example.
If you want to launch this example, type the following command and open http://localhost.
$ docker-compose up
It executes the following steps.
- Build a docker image whose definition is written in
Dockerfile
.- Since
Dockerfile
has multi stage build, this example requires Docker >=17.05
. - Multi stage build in this case is comprised of:
- Build SPA with webpack.
- Bundle it in a
nginx:alpine
. This image is quite smaller than single stage build.
- Since
- Run the image built above. The bootstrap script is
serve.sh
.- Generate
env.js
having environment variables defined indocker-compose.yml
. This will be loaded in SPA. - Generate
nginx.conf
nginx uses. - Start nginx with no daemon options.
- Generate
- docker-nginx-spa is a good example of dockerizing an SPA.