Dockerfile 556 B

123456789101112131415161718
  1. FROM node:14.0.0 as builder
  2. WORKDIR /app/tmr-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/sheep-admin/dist/ /usr/share/nginx/html/
  13. COPY --from=builder /app/sheep-admin/default.conf.template /etc/nginx/conf.d/default.conf
  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;\""]