Deploying to Production
In this section, we will learn how to deploy a production version of the app to the cloud. A common way to deploy applications is using Docker. With Docker, you can create a container that holds and runs the app.
Docker containers are portable, so once they are built, they can run on different machines or platforms. We will deploy the app to now.sh using Docker. This will make the app available on the internet so that we can share it with others.
For information on how to install Docker, you can visit the Docker Getting Started website (https://docs.docker.com/v17.09/get-started/) or the official documentation (https://docs.docker.com/).
Exercise 44: Adding a Dockerfile to our Project
In this exercise, we will add a Dockerfile
to our project. Follow these steps to complete this exercise:
- Create a file called
Dockerfile
in the root of the project. - Add the following contents:
FROM node:10-alpine RUN mkdir -p /app/dist WORKDIR /app COPY ...