Multi-stage Docker production builds

Our current Docker image, which we are creating from the Dockerfile, is already useful. We want our application to be transpiled and running in production mode, because many things are not optimized for the public when running in development mode.

Obviously, we have to run our build scripts for the back end and front end while generating the Docker image.

Up until now, we have installed all npm packages and copied all files and folders for our project to the container image. This is fine for development, because this image is not published or deployed to a production environment. When going live with your application, you will want your image to be as slim and efficient as possible. To achieve this, we ...

Get Hands-On Full-Stack Web Development with GraphQL and React now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.