Explorar o código

WIP: add Dockerfile

Yuki Takei %!s(int64=5) %!d(string=hai) anos
pai
achega
60e943aeb7

+ 74 - 0
packages/slackbot-proxy/docker/Dockerfile

@@ -0,0 +1,74 @@
+# syntax = docker/dockerfile:1.2
+
+##
+## deps-resolver
+##
+FROM node:14-slim AS deps-resolver
+LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
+
+ENV appDir /opt
+
+WORKDIR ${appDir}
+COPY ./package.json ./
+COPY ./yarn.lock ./
+COPY ./lerna.json ./
+
+# setup
+RUN yarn config set network-timeout 300000
+RUN npx lerna bootstrap
+
+
+
+##
+## deps-resolver-prod
+##
+FROM deps-resolver AS deps-resolver-prod
+
+# shrink dependencies for production
+RUN yarn install --production
+
+
+
+##
+## builder
+##
+FROM node:14-slim AS builder
+LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
+
+ENV appDir /opt
+
+COPY --from=deps-resolver ${appDir}/node_modules ${appDir}/node_modules
+
+# copy all packages
+COPY packages ${appDir}/packages
+
+COPY ./package.json ./
+COPY ./yarn.lock ./
+COPY ./lerna.json ./
+
+# build
+RUN yarn lerna run --scope @growi/slack --scope @growi/slackbot-proxy build
+
+
+
+##
+## release
+##
+FROM gcr.io/distroless/nodejs:14
+LABEL maintainer Yuki Takei <yuki@weseek.co.jp>
+
+ENV appDir /opt
+
+COPY --from=deps-resolver-prod \
+  ${appDir}/node_modules ${appDir}/node_modules
+COPY --from=builder \
+  ${appDir}/packages/slack/dist ${appDir}/slack
+COPY --from=builder \
+  ${appDir}/packages/slackbot-proxy/dist ${appDir}/slackbot-proxy
+
+WORKDIR ${appDir}
+
+VOLUME /data
+EXPOSE 3000
+
+CMD ["yarn", "server:prod"]

+ 66 - 0
packages/slackbot-proxy/docker/README.md

@@ -0,0 +1,66 @@
+
+GROWI Slackbot Proxy Server Official docker image
+==============================================
+
+[![Node CI for slackbot-proxy](https://github.com/weseek/growi/actions/workflows/ci-slackbot-proxy.yml/badge.svg)](https://github.com/weseek/growi/actions/workflows/ci-slackbot-proxy.yml) [![docker-pulls](https://img.shields.io/docker/pulls/weseek/growi-slackbot-proxy.svg)](https://hub.docker.com/r/weseek/growi-slackbot-proxy/)
+
+
+Supported tags and respective Dockerfile links
+------------------------------------------------
+
+* [`1.0.0`, `1.0`, `1`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/master/docker/Dockerfile)
+
+
+What is GROWI Slackbot Proxy Server?
+----------------------------------
+
+The proxy server produced by GROWI Development Team, provides the backend for Slack App (Bot) to integrate GROWI Apps and Slack workspaces.
+
+see: (TBD)
+
+
+Requirements
+-------------
+
+* MySQL (>= 8.0)
+
+### Optional Dependencies
+
+* 
+
+
+Usage
+-----
+
+Create `.env.production.local`
+
+```
+```
+
+```bash
+docker run -d \
+    -e TYPEORM_CONNECTION=mysql \
+    -e TYPEORM_HOST=mysqlserver \
+    -e TYPEORM_DATABASE=growi-slackbot-proxy \
+    -e TYPEORM_USERNAME=growi-slackbot-proxy \
+    -e TYPEORM_PASSWORD=CHANGE-IT \
+    -e SLACK_CLIENT_ID=000000000000.0000000000000 \
+    -e SLACK_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
+    -e SLACK_SIGNING_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
+    weseek/growi-slackbot-proxy
+```
+
+and go to `http://localhost:8080/` .
+
+### docker-compose
+
+(TBD)
+
+Configuration
+-----------
+
+(TBD)
+
+### Environment Variables
+
+(TBD)