Dockerfile_aiportal 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ############################################
  2. # 构建打包阶段
  3. ############################################
  4. FROM node:10.20.1 as builder
  5. WORKDIR /tmp
  6. COPY ./package.json yarn.lock .yarnrc ./
  7. COPY ./.yarnrc /root/
  8. RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list && \
  9. apt-get clean && \
  10. apt-get update && \
  11. apt-get install -y --no-install-recommends libpng-dev nasm autoconf build-essential pkg-config automake libtool gifsicle optipng pngquant
  12. RUN echo ":::::: 1. 安装依赖包 yarn install" && \
  13. npm config set registry http://registry.npmjs.org && \
  14. npm config set disturl https://npm.taobao.org/dist && \
  15. npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass && \
  16. yarn config set registry 'https://registry.npm.taobao.org' -g && \
  17. yarn config set disturl 'https://npm.taobao.org/dist' -g && \
  18. yarn config set sass_binary_site 'https://npm.taobao.org/mirrors/node-sass' -g && \
  19. yarn config get registry && \
  20. yarn install --registry https://registry.npm.taobao.org
  21. COPY ./ .
  22. RUN echo ":::::: 2. 项目打包构建,构建基础模块 yarn build" && yarn build && echo ":::::: 3. 项目打包构建,构建portal模块 yarn build"
  23. RUN cd ./ai-modules/portal && yarn install --registry https://registry.npm.taobao.org && yarn build
  24. ############################################
  25. # 构建nginx镜像
  26. ############################################
  27. echo ":::::: 3. 构建nginx镜像"
  28. FROM nginx:alpine
  29. USER root
  30. ENV TZ=Asia/Shanghai
  31. WORKDIR /data/ai_lab/ai_web
  32. COPY --from=builder /tmp/build /usr/share/nginx/html/
  33. COPY --from=builder /tmp/ai-modules/portal/build /usr/share/nginx/html/portal/
  34. COPY ./Dockerfile/nginx_aiportal.conf /etc/nginx/nginx.env.conf
  35. COPY ./Dockerfile/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
  36. RUN mkdir -p /data/ai_lab/ai_web/logs/ && \
  37. chmod u+x /usr/local/bin/docker-entrypoint.sh && \
  38. ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
  39. EXPOSE 8181
  40. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  41. CMD ["nginx","-g","daemon off;"]