Dockerfile 587 B

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