Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. # build
  34. RUN yarn build:prod
  35. # shrink dependencies for production
  36. RUN yarn install --production
  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. WORKDIR /tmp
  47. RUN --mount=target=. sh bin/symlink-for-uploading-to-local.sh
  48. WORKDIR ${appDir}
  49. USER node
  50. VOLUME /data
  51. EXPOSE 3000
  52. ENTRYPOINT ["/sbin/tini", "-e", "143", "--"]
  53. CMD ["yarn", "server:prod"]