Dockerfile 548 B

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