Dockerfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # syntax = docker/dockerfile:experimental
  2. ARG flavor=default
  3. ##
  4. ## setupper-default
  5. ##
  6. FROM node:12-slim AS setupper-default
  7. LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
  8. ENV appDir /opt/growi
  9. RUN mkdir -p ${appDir}
  10. RUN mv .* ${appDir}/
  11. WORKDIR ${appDir}
  12. # setup
  13. RUN yarn config set network-timeout 300000
  14. RUN yarn
  15. # install official plugins
  16. RUN yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  17. # install peerDependencies
  18. RUN yarn add -D react-images react-motion
  19. ##
  20. ## setupper-nocdn
  21. ##
  22. FROM setupper-default AS setupper-nocdn
  23. # replace env.prod.js for NO_CDN
  24. COPY nocdn/env.prod.js config
  25. ##
  26. ## builder
  27. ##
  28. FROM setupper-${flavor} AS builder
  29. ENV appDir /opt/growi
  30. # build
  31. RUN yarn build:prod
  32. # shrink dependencies for production
  33. RUN yarn install --production
  34. # remove unnecessary files
  35. WORKDIR /tmp
  36. RUN --mount=target=. sh bin/remove-unnecessary-files.sh
  37. WORKDIR ${appDir}
  38. ##
  39. ## release
  40. ##
  41. FROM node:12-alpine
  42. LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
  43. ENV appDir /opt/growi
  44. # install tini
  45. RUN apk add --no-cache tini
  46. COPY --from=builder ${appDir} ${appDir}
  47. # create symlink for FILE_UPLOAD=local
  48. WORKDIR /tmp
  49. RUN --mount=target=. sh bin/symlink-for-uploading-to-local.sh
  50. WORKDIR ${appDir}
  51. USER node
  52. VOLUME /data
  53. EXPOSE 3000
  54. ENTRYPOINT ["/sbin/tini", "-e", "143", "--"]
  55. CMD ["yarn", "server:prod"]