How to Dockerize an Angular 7 App



Hi,

We are going to Dockerize our Angular 7 application, the angular version is not very important after version 2. So we may use the same process for Angular 2+

  1. Create your angular app. (ng new APP_NAME)
  2. Create your Dockerfile 
  3. Run your Docker :)
For my example I'm creating the application called "fe-stock-angular" the command is : 

ng new fe-stock-angular

In the same directory, we will create a Dockerfile this file won't be inside the application folder but the upper folder like :



Now create the Dockerfile as follow


Now build your image
docker build -t fe-stock-angular . 
And the last step, run your docker image

docker run -i -t -p 8080:80 fe-stock-angular

Now you can open your browser to check your application :

localhost:8080