- Compile your Angular project for production use
- "ng build --prod"
- copy the 'Dockerfile', 'nginx.conf', files from this repository to 'dist' folder in your project.
- run "docker build -t angular-docker ."
- check docker image using "docker image ls"
- start docker using "docker run -p 3000:80 --rm angular-docker"
- open browser tab and run "http://localhost:3000/"
- run "docker-compose up --build" to build docker image and start the server.
- run "docker build -t angular-docker ." if the above command gives error.
- run "docker-compose up" to start existing docker image.
- run "docker-compose down" to stop docker process.
- Optional "docker-compose down --rmi all" to remove everything.
- You can use either of the method specified above. The simplest one is by using docker-compose.yml file.
- To start the server on port 80, make sure that there is no service currently open, which is using port 80. In the case of nginx running already on port 80, use "sudo service nginx stop" command. Then use "docker run -p 80:80 --rm angular-docker"
- For ssl comment out lines from nginx.conf file and alos include the required ssl files like .crt(ssl certificate) and .key(private key).