12345678910111213141516171819 |
- FROM node:14.0.0 as builder
- WORKDIR /app/calf-feed-admin
- #拷贝源码
- COPY . .
- #安装依赖
- RUN npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
- RUN npm install
- # 开始构建
- RUN npm run build
- # 第二阶段构建
- FROM nginx:alpine
- COPY --from=builder /app/calf-feed-admin/dist/ /usr/share/nginx/html/
- COPY --from=builder /app/calf-feed-admin/default.conf.template /etc/nginx/templates/default.conf.template
- EXPOSE 80
- CMD ["/bin/sh", "-c", "sed -i \"s@<html@<html domain=\"$DOMAIN\"@\" /usr/share/nginx/html/index.html; nginx -g \"daemon off;\""]
|