Dockerfile 583 B

12345678910111213141516171819
  1. FROM node:14.0.0 as builder
  2. WORKDIR /app/tmr-group-admin
  3. #拷贝源码
  4. COPY . .
  5. #安装依赖
  6. RUN npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
  7. RUN npm install
  8. # 开始构建
  9. RUN npm run build:prod
  10. # 第二阶段构建
  11. FROM nginx:alpine
  12. COPY --from=builder /app/tmr-group-admin/dist/ /usr/share/nginx/html/
  13. COPY --from=builder /app/tmr-group-admin/default.conf.template /etc/nginx/templates/default.conf.template
  14. EXPOSE 80
  15. CMD ["/bin/sh", "-c", "sed -i \"s@<html@<html domain=\"$DOMAIN\"@\" /usr/share/nginx/html/index.html; nginx -g \"daemon off;\""]