FROM yldc-docker.pkg.coding.yili.com/pubrepo/pubdocker/nginx:latest # ---------------------只改此处,其它不动-------------------------- # 定义构建物目录 当前目录 ./ 为代码根目录 # ARG DIST_DIR=./dist ARG DIST_DIR=./dist # 定义目标相对目录,访问url即为: /${URL_DIR}/index.html ARG URL_DIR= # ---------------------------------------------------------------- COPY ${DIST_DIR} /var/www/html/${URL_DIR} # VUE history路由模式,释放此行(无需更改内容),以更改nginx conf 的 try_files路径 RUN sed -i "s/\ \/index.html/\ \/${URL_DIR}\/index.html/g" /etc/nginx/conf.d/default.conf # 默认不建议使用自定义nginx配置,如必须使用,请提前沟通 # COPY ./nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80