apps.Dockerfile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM node:12 as builder
  2. WORKDIR /joystream
  3. COPY . /joystream
  4. # Do not set NODE_ENV=production until after running yarn install
  5. # to ensure dev dependencies are installed.
  6. RUN yarn install --frozen-lockfile
  7. # ENV NODE_ENV=production
  8. RUN yarn workspace pioneer build
  9. RUN yarn workspace @joystream/cli build
  10. RUN yarn workspace storage-node build
  11. # The image is huge ~ 3GB!
  12. # npm package Pruning.. getting rid of all devDependencies.
  13. # ... to significantly reduce image size (by multiple GBs): It may cause problems in case:
  14. # 1. There are package dependencies which were added (incorrectly) as dev dependencies..
  15. # 2. 'ts-node' is used and added as a non-dev dep -> ends up pulling in dependencies which
  16. # would normally just be dev dependencies?
  17. # some packages that are big: @types, babel, electron, prettier, eslint, test frameworks
  18. # RUN npm prune --production
  19. # I think it works for a simple pacakge but npm prune doesn't recognize yarn workspaces
  20. # so it ends up removing too much and things break
  21. # "yarn pruning"
  22. # RUN cp -R node_modules/.bin somewhere.. ?
  23. # But don't yarn workspace packages also go into node_modules/ ?
  24. # How to keep those?
  25. # RUN rm -fr node_modules/
  26. # RUN yarn install --production // should not have post install build steps that depend on devDependencies
  27. # // RUN yarn cache clean
  28. # Drops to 1.6GB but still too big!
  29. # FROM node:12
  30. # COPY --from=builder /joystream /joystream
  31. # WORKDIR /joystream
  32. ENTRYPOINT [ "yarn" ]