As we described in the previous scenario, all images started with a base image, ideally as close to your desired configuration as possible. Node.js has pre-built images available with tags for each released version.
The image for Node 10.0 is node:10-alpine. This is an Alpine-based build which is smaller and more streamlined than the official image.
Alongside the base image, we also need to create the base directories of where the application runs from. Using the RUN <command> we can execute commands as if they're running from a command shell, by using
mkdir we can create the directories where the application will execute from. In this case, an ideal directory would be /src/app as the environment user has read/write access to this directory.
We can define a working directory using WORKDIR <directory> to ensure that all future commands are executed from the directory relative to our application.
Task: Define Base Environment
Set the FROM <image>:<tag>, RUN <command> and WORKDIR <directory> on separate lines to configure the base environment for deploying your application.