Dockerfile 467 B

123456789101112131415161718192021222324
  1. FROM node:lts-alpine as builder
  2. WORKDIR /code
  3. ADD package.json /code
  4. RUN npm install
  5. ADD . /code
  6. RUN npm run build
  7. #环境变量写在build后面否则找不到指令
  8. ENV PROJECT_ENV production
  9. ENV NODE_ENV production
  10. FROM nginx:alpine
  11. # 设置时区
  12. #RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  13. #RUN echo 'Asia/Shanghai' >/etc/timezone
  14. COPY --from=builder code/dist/ /usr/share/nginx/html/
  15. COPY ./nginx.conf /etc/nginx/nginx.conf
  16. EXPOSE 80