The third and final stage generates the container that will be your web server. Once this stage is complete, the prior stages will be discarded and the end result will be an optimized sub-10 MB container:
- Containerize your application with Docker, as discussed in Chapter 3,
- Append the FROM statement at the end of the file
- COPY the production ready code from builder as shown here:
Docker.integration...FROM duluca/minimal-nginx-web-server:1.13.8-alpineENV BUILDER_SRC_DIR /usr/srcCOPY --from=builder $BUILDER_SRC_DIR/dist /var/wwwCMD 'nginx'
- Build and test your multi-stage Dockerfile:
$ docker build -f Dockerfile.integration .