Dockerfile 588 B

12345678910111213141516171819
  1. FROM node:14.0.0 as builder
  2. WORKDIR /app/calf-feed-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
  10. # 第二阶段构建
  11. FROM nginx:stable-alpine3.17
  12. COPY --from=builder /app/calf-feed-admin/dist/ /usr/share/nginx/html/
  13. COPY --from=builder /app/calf-feed-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;\""]