1、官方文档:
https://www.angular.cn/guide/quickstart
2、angular build docker image 过程
2.1、build angular project
ng build --prod 在dist目录中生成my-app目录
2.2、create Dockerfile
FROM node AS builder
# set working directory
WORKDIR /app
# install and cache app dependencies
COPY . /app
FROM nginx:stable-alpine
# copy from dist to nginx root dir
COPY --from=builder /app/dist/my-app /usr/share/nginx/html
# expose port 80
EXPOSE 80
# run nginx in foreground
# https://stackoverflow.com/questions/18861300/how-to-run-nginx-within-a-docker-container-without-halting
CMD ["nginx", "-g", "daemon off;"]
2.3、build docker image
docker build -t="mynodejs:latest" .
2.4、run docker image
docker run -i -t -d -p 80:80 --name mynodejs mynodejs:latest
2.5、 create docker-compose.yml file

3、angular docker design
https://github.com/angular/angular-cli/blob/master/docs/design/docker-deploy.md
网友评论