首页 > 移动平台 > 详细

[Angular CLI] Build application without remove dist folder for Docker Volume

时间:2019-04-17 19:11:46      阅读:124      评论:0      收藏:0      [点我收藏+]

When we develop the Angular app inside Docker container, we can simulate Production envioment by build Angualr App instead of using ‘ng serve‘:

ng build --watch --delete-output-path false

--delete-output-path false‘: tells it do not delete the dist folder when doing the build.

 

nginx.dockerfile file:

FROM nginx:alpine
LABEL author="Dan Wahlin"
COPY ./config/nginx.conf /etc/nginx/conf.d/default.conf

# Use the following commands to build the image and run the container (run from the root folder)
# 1. You‘ll first need to build the project using `ng build --watch --delete-output-path false`

# 2. Now build the Docker image:
# docker build -t nginx-angular -f nginx.dockerfile .

#3. Run the Docker container:
# To run the container we‘ll create a volume to point to our local source code. On Mac
# you can use $(pwd) to reference your local folder where your running Docker commands from.
# If you‘re on Windows there are several options to point to the folder. See my following post:
# https://blog.codewithdan.com/2017/10/25/docker-volumes-and-print-working-directory-pwd/

# docker run -p 8080:80 -v $(pwd)/dist:/usr/share/nginx/html nginx-angular

 

[Angular CLI] Build application without remove dist folder for Docker Volume

原文:https://www.cnblogs.com/Answer1215/p/10725411.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!