Dockerfile 1.5 KB

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