Dockerfile 781 B

12345678910111213141516171819202122
  1. FROM node:14-alpine AS js-builder
  2. WORKDIR /app
  3. RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
  4. RUN apk --no-cache add make g++ git python3
  5. RUN npm config set registry https://registry.npm.taobao.org
  6. RUN npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ && \
  7. npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ && \
  8. npm config set nodejieba_binary_host_mirror https://npm.taobao.org/mirrors/nodejieba
  9. COPY package.json ./
  10. RUN npm install
  11. COPY . .
  12. FROM js-builder AS dev
  13. CMD ["npm", "run", "staging"]
  14. FROM js-builder AS prod-builder
  15. RUN npm run build
  16. FROM nginx:stable-alpine AS prod
  17. COPY --from=prod-builder /app/dist /usr/share/nginx/html
  18. EXPOSE 80
  19. CMD ["nginx", "-g", "daemon off;"]