Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ##
  2. ## STAGE 1
  3. ##
  4. FROM node:12-slim AS builder
  5. LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
  6. ENV APP_VERSION v3.5.13
  7. ENV APP_DIR /opt/growi
  8. ARG ARCHIVE_NAME=${APP_VERSION}
  9. # update tar for '--strip-components' option
  10. # RUN apk add --no-cache --update tar
  11. # download GROWI archive from Github
  12. # RUN apk add --no-cache --virtual .dl-deps curl \
  13. RUN mkdir -p ${APP_DIR}
  14. RUN curl -SL https://github.com/weseek/growi/archive/${ARCHIVE_NAME}.tar.gz \
  15. | tar -xz -C ${APP_DIR} --strip-components 1
  16. WORKDIR ${APP_DIR}
  17. # setup
  18. RUN yarn config set network-timeout 300000
  19. RUN yarn
  20. # install official plugins
  21. RUN yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
  22. # install peerDependencies
  23. RUN yarn add -D react-images react-motion
  24. # build
  25. RUN npm run build:prod
  26. # shrink dependencies for production
  27. RUN yarn install --production
  28. ##
  29. ## STAGE 2
  30. ##
  31. FROM node:12-alpine
  32. LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
  33. ENV APP_DIR /opt/growi
  34. # install tini
  35. RUN apk add --no-cache tini
  36. USER node
  37. COPY --from=builder ${APP_DIR} ${APP_DIR}
  38. WORKDIR ${APP_DIR}
  39. VOLUME /data
  40. EXPOSE 3000
  41. ENTRYPOINT ["/sbin/tini", "-e", "143", "--"]
  42. CMD ["npm", "run", "server:prod"]