Write the Dockerfile
Now that we have our app, in the same location of the app.js in VSCode we will create a Dockerfile.
A Dockerfile is a text document that contains all the commands to assemble an image.
Here’s a simple example
# Use an official image as a parent image
FROM node:14
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages
RUN npm install
# Make port 8080 available to the world outside this container
EXPOSE 8080
# Run app.js when the container launches
CMD ["node", "app.js"]
6