Guest User

Untitled

a guest
Jan 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. # Purpose
  2. # Leverage Docker multi-stage layers to cache
  3. # node_modules and achieve faster build times
  4.  
  5. #Stage 1 - Create cached node_modules.
  6. # Only rebuild layer if package.json has changed
  7. FROM node:10.15-alpine as node_cache
  8. WORKDIR /cache/
  9. COPY package.json .
  10. RUN npm prune
  11. RUN npm install
  12.  
  13. #Stage 2 - Builder root with Chromium installed
  14. FROM zenika/alpine-chrome
  15. USER root
  16. RUN apk add --no-cache make gcc g++ python git nodejs nodejs-npm yarn \
  17. && rm -rf /var/lib/apt/lists/* \
  18. /var/cache/apk/* \
  19. /usr/share/man \
  20. /tmp/*
  21. WORKDIR /root/
  22. COPY --from=node_cache /cache/ .
  23. # Copy source files, and possibily invalidate so we have to rebuild
  24. COPY . .
  25. ENTRYPOINT ["npm", "run"]
Add Comment
Please, Sign In to add comment