Deploying using configuration files and support scripts
To deploy our application to a production server, we will use a combination of simple commands and support scripts that start or update the running set of containers. Let's start by taking a close look at the two most important files required for deployment: Dockerfile
and docker-compose.yml
.
Re-examining the initial Dockerfile
The Dockerfile from Chapter 5, Alternatives for Deploying and Running Containers in Production, has good layering and has package.json
and package.json.lock
copied into the image before RUN npm -s install
executes and before the main parts of the app are copied into the image. However, it has some rough edges, which we are going to smooth out in this chapter to prepare a solid production deployment. First, let's take a look at the initial Dockerfile:
FROM ubuntu:bionic RUN apt-get -qq update && \ apt-get -qq install -y nodejs npm > /dev/null RUN mkdir...