浏览代码

use pm2 to guard and monitor the web service in docker file (#2238)

tags/0.5.3
Bowen Liang 1年前
父节点
当前提交
965ca36525
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 16 次插入12 次删除
  1. 5
    0
      web/Dockerfile
  2. 1
    1
      web/docker/entrypoint.sh
  3. 10
    11
      web/docker/pm2.json

+ 5
- 0
web/Dockerfile 查看文件

@@ -40,12 +40,17 @@ ENV TZ UTC
RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone

# global runtime packages
RUN yarn global add pm2 \
&& yarn cache clean

WORKDIR /app/web
COPY --from=builder /app/web/public ./public
COPY --from=builder /app/web/.next/standalone ./
COPY --from=builder /app/web/.next/static ./.next/static


COPY docker/pm2.json ./pm2.json
COPY docker/entrypoint.sh ./entrypoint.sh

ARG COMMIT_SHA

+ 1
- 1
web/docker/entrypoint.sh 查看文件

@@ -10,4 +10,4 @@ export NEXT_PUBLIC_PUBLIC_API_PREFIX=${APP_API_URL}/api
export NEXT_PUBLIC_SENTRY_DSN=${SENTRY_DSN}
export NEXT_PUBLIC_SITE_ABOUT=${SITE_ABOUT}

node ./server.js
pm2 start ./pm2.json --no-daemon

+ 10
- 11
web/docker/pm2.json 查看文件

@@ -1,12 +1,11 @@
{
"apps": [
{
"name": "WebApp",
"exec_mode": "cluster",
"instances": 1,
"script": "./node_modules/next/dist/bin/next",
"cwd": "/app/web",
"args": "start"
}
]
}
"apps": [
{
"name": "dify-web",
"script": "/app/web/server.js",
"cwd": "/app/web",
"exec_mode": "cluster",
"instances": 2
}
]
}

正在加载...
取消
保存