Dockerfile_Prod 530 B

1234567891011121314151617181920212223242526
  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:prod
  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 simsun.ttc /usr/share/fonts/simsun.ttc
  15. COPY --from=builder code/dist/ /usr/share/nginx/html/
  16. COPY ./docker/prod/nginx.conf /etc/nginx/nginx.conf
  17. EXPOSE 80