2
0

Dockerfile 1.3 KB

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