FROM node:14.0.0 as builder
WORKDIR /app/tmr-admin
#拷贝源码
COPY . .
#安装依赖
RUN npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
RUN npm install

# 开始构建
RUN npm run build:prod

# 第二阶段构建
FROM nginx:alpine
COPY --from=builder /app/tmr-admin/dist/ /usr/share/nginx/html/
COPY --from=builder /app/tmr-admin/default.conf.template /etc/nginx/templates/default.conf.template
EXPOSE 80
