Angular + Docker: Dockerize your app in 5 minutes! (video included)
Taking an angular application into production can be daunting enough as it is. This is a simple, straight-forward, guide that will have you running your application inside of a docker container in 5-minutes flat.
We’ll use an node.js container to build your application but then move over into an nginx container to serve the final product. It’s a common misconception that running your production built application from a node.js http server is the right way to go. Please do not do this.
By moving into an nginx container we copy only your dist directory and leave everything else behind!
https://www.youtube.com/watch?v=iHPErFiOV-o?ecver=2
Dockerfile
First, place this Dockerfile in your applications root directory:
FROM node:alpine AS builder
WORKDIR /app
COPY . .
RUN npm install && \
npm run build
FROM nginx:alpine
COPY --from=builder /app/dist/* /usr/share/nginx/html/
Docker Commands
Now build your docker image:
$ docker build -t my-angular-app:v1 .
Then run it!
$ docker run -p 80:80 my-angular-app:v1
It’s a common misconception that running your production built application from a node.js http server is the right way to go. Please do not do this.
Can you elaborate more on this ?
Instead of
do
why would you make a video with purple text on a black background