apps.Dockerfile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. # Pioneer is failing to build only on github actions workflow runner
  9. # Error: packages/page-staking/src/index.tsx(24,21): error TS2307: Cannot find module './Targets' or its corresponding type declarations.
  10. # RUN yarn workspace pioneer build
  11. RUN yarn workspace @joystream/cli build
  12. RUN yarn workspace storage-node build
  13. # The image is huge ~ 3GB!
  14. # npm package Pruning.. getting rid of all devDependencies.
  15. # ... to significantly reduce image size (by multiple GBs): It may cause problems in case:
  16. # 1. There are package dependencies which were added (incorrectly) as dev dependencies..
  17. # 2. 'ts-node' is used and added as a non-dev dep -> ends up pulling in dependencies which
  18. # would normally just be dev dependencies?
  19. # some packages that are big: @types, babel, electron, prettier, eslint, test frameworks
  20. # RUN npm prune --production
  21. # I think it works for a simple pacakge but npm prune doesn't recognize yarn workspaces
  22. # so it ends up removing too much and things break
  23. # "yarn pruning"
  24. # RUN cp -R node_modules/.bin somewhere.. ?
  25. # But don't yarn workspace packages also go into node_modules/ ?
  26. # How to keep those?
  27. # RUN rm -fr node_modules/
  28. # RUN yarn install --production // should not have post install build steps that depend on devDependencies
  29. # // RUN yarn cache clean
  30. # Drops to 1.6GB but still too big!
  31. # FROM node:12
  32. # COPY --from=builder /joystream /joystream
  33. # WORKDIR /joystream
  34. ENTRYPOINT [ "yarn" ]