Przeglądaj źródła

Merge pull request #1396 from weseek/support/include-dockerfile

Support/include dockerfile
Yuki Takei 6 lat temu
rodzic
commit
03c44ea475

+ 81 - 0
docker/Dockerfile

@@ -0,0 +1,81 @@
+# syntax = docker/dockerfile:experimental
+
+ARG flavor=default
+
+
+
+##
+## setupper-default
+##
+FROM node:12-slim AS setupper-default
+LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
+
+ENV appVersion v3.5.13
+ARG archiveName=${appVersion}
+ENV appDir /opt/growi
+
+RUN mkdir -p ${appDir}
+
+# download GROWI archive from Github
+RUN curl -SL https://github.com/weseek/growi/archive/${archiveName}.tar.gz \
+    | tar -xz -C ${appDir} --strip-components 1
+
+WORKDIR ${appDir}
+
+# setup
+RUN yarn config set network-timeout 300000
+RUN yarn
+# install official plugins
+RUN yarn add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs
+# install peerDependencies
+RUN yarn add -D react-images react-motion
+
+
+
+##
+## setupper-nocdn
+##
+FROM setupper-default AS setupper-nocdn
+
+# replace env.prod.js for NO_CDN
+COPY nocdn/env.prod.js config
+
+
+
+##
+## builder
+##
+FROM setupper-${flavor} AS builder
+
+# build
+RUN yarn build:prod
+# shrink dependencies for production
+RUN yarn install --production
+
+
+
+##
+## release
+##
+FROM node:12-alpine
+LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
+
+ENV appDir /opt/growi
+
+# install tini
+RUN apk add --no-cache tini
+
+COPY --from=builder ${appDir} ${appDir}
+
+WORKDIR /tmp
+
+RUN --mount=target=. sh bin/symlink-for-uploading-to-local.sh
+
+WORKDIR ${appDir}
+
+USER node
+VOLUME /data
+EXPOSE 3000
+
+ENTRYPOINT ["/sbin/tini", "-e", "143", "--"]
+CMD ["yarn", "server:prod"]

+ 9 - 0
docker/bin/symlink-for-uploading-to-local.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+# Corresponds to `FILE_UPLOAD=local`
+mkdir -p /data/uploads
+if [ ! -e "$appDir/public/uploads" ]; then
+  ln -s /data/uploads $appDir/public/uploads
+fi

+ 6 - 0
docker/nocdn/env.prod.js

@@ -0,0 +1,6 @@
+module.exports = {
+    NODE_ENV: 'production',
+    NO_CDN: true,
+    // FORMAT_NODE_LOG: false,
+  };
+