1234567891011121314151617181920212223242526272829303132333435363738394041 |
- ############################################
- # 构建打包阶段
- ############################################
- FROM node:10.20.1 as builder
- WORKDIR /tmp
- COPY ./package.json yarn.lock .yarnrc ./
- COPY ./.yarnrc /root/
- RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list && \
- apt-get clean && \
- apt-get update && \
- apt-get install -y --no-install-recommends libpng-dev nasm autoconf build-essential pkg-config automake libtool gifsicle optipng pngquant
- RUN echo ":::::: 1. 安装依赖包 yarn install" && \
- npm config set registry http://registry.npmjs.org && \
- npm config set disturl https://npm.taobao.org/dist && \
- npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass && \
- yarn config set registry 'https://registry.npm.taobao.org' -g && \
- yarn config set disturl 'https://npm.taobao.org/dist' -g && \
- yarn config set sass_binary_site 'https://npm.taobao.org/mirrors/node-sass' -g && \
- yarn config get registry && \
- yarn install --registry https://registry.npm.taobao.org
- COPY ./ .
- RUN echo ":::::: 2. 项目打包构建,构建基础模块 yarn build" && yarn build && echo ":::::: 3. 项目打包构建,构建portal模块 yarn build"
- RUN cd ./ai-modules/portal && yarn install --registry https://registry.npm.taobao.org && yarn build
- ############################################
- # 构建nginx镜像
- ############################################
- echo ":::::: 3. 构建nginx镜像"
- FROM nginx:alpine
- USER root
- ENV TZ=Asia/Shanghai
- WORKDIR /data/ai_lab/ai_web
- COPY --from=builder /tmp/build /usr/share/nginx/html/
- COPY --from=builder /tmp/ai-modules/portal/build /usr/share/nginx/html/portal/
- COPY ./Dockerfile/nginx_aiportal.conf /etc/nginx/nginx.env.conf
- COPY ./Dockerfile/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
- RUN mkdir -p /data/ai_lab/ai_web/logs/ && \
- chmod u+x /usr/local/bin/docker-entrypoint.sh && \
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
- EXPOSE 8181
- ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
- CMD ["nginx","-g","daemon off;"]
|