yixian56 commited on
Commit
0ed41e8
·
verified ·
1 Parent(s): 4569874

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -43
Dockerfile CHANGED
@@ -1,46 +1,44 @@
1
  FROM langgenius/dify-web:1.4.1
2
 
3
- # 创建entrypoint.sh脚本并嵌入内容
4
- RUN <<EOF cat > /entrypoint.sh
5
- #!/bin/bash
6
 
7
- # if you are using windows, you may need to convert the file to unix format
8
- # you can use the Ubuntu terminal to convert this file to unix format
9
- # otherwise, you may get the error after running the docker container
10
-
11
- # sudo apt-get install dos2unix
12
- # dos2unix entrypoint.sh
13
-
14
- set -e
15
-
16
- export NEXT_PUBLIC_DEPLOY_ENV=\${DEPLOY_ENV}
17
- export NEXT_PUBLIC_EDITION=\${EDITION}
18
- export NEXT_PUBLIC_API_PREFIX=\${CONSOLE_API_URL}/console/api
19
- export NEXT_PUBLIC_PUBLIC_API_PREFIX=\${APP_API_URL}/api
20
- export NEXT_PUBLIC_MARKETPLACE_API_PREFIX=\${MARKETPLACE_API_URL}/api/v1
21
- export NEXT_PUBLIC_MARKETPLACE_URL_PREFIX=\${MARKETPLACE_URL}
22
-
23
- export NEXT_PUBLIC_SENTRY_DSN=\${SENTRY_DSN}
24
- export NEXT_PUBLIC_SITE_ABOUT=\${SITE_ABOUT}
25
- export NEXT_TELEMETRY_DISABLED=\${NEXT_TELEMETRY_DISABLED}
26
-
27
- export NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS=\${TEXT_GENERATION_TIMEOUT_MS}
28
- export NEXT_PUBLIC_CSP_WHITELIST=\${CSP_WHITELIST}
29
- export NEXT_PUBLIC_ALLOW_EMBED=\${ALLOW_EMBED}
30
- export NEXT_PUBLIC_TOP_K_MAX_VALUE=\${TOP_K_MAX_VALUE}
31
- export NEXT_PUBLIC_INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=\${INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH}
32
- export NEXT_PUBLIC_MAX_TOOLS_NUM=\${MAX_TOOLS_NUM}
33
- export NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER=\${ENABLE_WEBSITE_JINAREADER:-true}
34
- export NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL=\${ENABLE_WEBSITE_FIRECRAWL:-true}
35
- export NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL=\${ENABLE_WEBSITE_WATERCRAWL:-true}
36
- export NEXT_PUBLIC_LOOP_NODE_MAX_COUNT=\${LOOP_NODE_MAX_COUNT}
37
- export NEXT_PUBLIC_MAX_PARALLEL_LIMIT=\${MAX_PARALLEL_LIMIT}
38
- export NEXT_PUBLIC_MAX_ITERATIONS_NUM=\${MAX_ITERATIONS_NUM}
39
- pm2 start /app/web/server.js --name dify-web --cwd /app/web -i \${PM2_INSTANCES} --no-daemon
40
- EOF
41
-
42
- # 确保脚本可执行
43
- RUN chmod +x /entrypoint.sh
44
 
45
  # 配置环境变量
46
  ENV NEXT_TELEMETRY_DISABLED=0 \
@@ -66,6 +64,4 @@ WORKDIR /app
66
  EXPOSE 3000
67
 
68
  # 设置入口点
69
- ENTRYPOINT ["/entrypoint.sh"]
70
-
71
- # 注意:这里不需要CMD命令,因为entrypoint.sh脚本最后直接启动了pm2服务
 
1
  FROM langgenius/dify-web:1.4.1
2
 
3
+ USER root
 
 
4
 
5
+ # 创建entrypoint.sh脚本(使用常规方式而不是heredoc)
6
+ RUN echo '#!/bin/bash' > /app/entrypoint.sh && \
7
+ echo '' >> /app/entrypoint.sh && \
8
+ echo '# if you are using windows, you may need to convert the file to unix format' >> /app/entrypoint.sh && \
9
+ echo '# you can use the Ubuntu terminal to convert this file to unix format' >> /app/entrypoint.sh && \
10
+ echo '# otherwise, you may get the error after running the docker container' >> /app/entrypoint.sh && \
11
+ echo '' >> /app/entrypoint.sh && \
12
+ echo '# sudo apt-get install dos2unix' >> /app/entrypoint.sh && \
13
+ echo '# dos2unix entrypoint.sh' >> /app/entrypoint.sh && \
14
+ echo '' >> /app/entrypoint.sh && \
15
+ echo 'set -e' >> /app/entrypoint.sh && \
16
+ echo '' >> /app/entrypoint.sh && \
17
+ echo 'export NEXT_PUBLIC_DEPLOY_ENV=${DEPLOY_ENV}' >> /app/entrypoint.sh && \
18
+ echo 'export NEXT_PUBLIC_EDITION=${EDITION}' >> /app/entrypoint.sh && \
19
+ echo 'export NEXT_PUBLIC_API_PREFIX=${CONSOLE_API_URL}/console/api' >> /app/entrypoint.sh && \
20
+ echo 'export NEXT_PUBLIC_PUBLIC_API_PREFIX=${APP_API_URL}/api' >> /app/entrypoint.sh && \
21
+ echo 'export NEXT_PUBLIC_MARKETPLACE_API_PREFIX=${MARKETPLACE_API_URL}/api/v1' >> /app/entrypoint.sh && \
22
+ echo 'export NEXT_PUBLIC_MARKETPLACE_URL_PREFIX=${MARKETPLACE_URL}' >> /app/entrypoint.sh && \
23
+ echo '' >> /app/entrypoint.sh && \
24
+ echo 'export NEXT_PUBLIC_SENTRY_DSN=${SENTRY_DSN}' >> /app/entrypoint.sh && \
25
+ echo 'export NEXT_PUBLIC_SITE_ABOUT=${SITE_ABOUT}' >> /app/entrypoint.sh && \
26
+ echo 'export NEXT_TELEMETRY_DISABLED=${NEXT_TELEMETRY_DISABLED}' >> /app/entrypoint.sh && \
27
+ echo '' >> /app/entrypoint.sh && \
28
+ echo 'export NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS=${TEXT_GENERATION_TIMEOUT_MS}' >> /app/entrypoint.sh && \
29
+ echo 'export NEXT_PUBLIC_CSP_WHITELIST=${CSP_WHITELIST}' >> /app/entrypoint.sh && \
30
+ echo 'export NEXT_PUBLIC_ALLOW_EMBED=${ALLOW_EMBED}' >> /app/entrypoint.sh && \
31
+ echo 'export NEXT_PUBLIC_TOP_K_MAX_VALUE=${TOP_K_MAX_VALUE}' >> /app/entrypoint.sh && \
32
+ echo 'export NEXT_PUBLIC_INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=${INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH}' >> /app/entrypoint.sh && \
33
+ echo 'export NEXT_PUBLIC_MAX_TOOLS_NUM=${MAX_TOOLS_NUM}' >> /app/entrypoint.sh && \
34
+ echo 'export NEXT_PUBLIC_ENABLE_WEBSITE_JINAREADER=${ENABLE_WEBSITE_JINAREADER:-true}' >> /app/entrypoint.sh && \
35
+ echo 'export NEXT_PUBLIC_ENABLE_WEBSITE_FIRECRAWL=${ENABLE_WEBSITE_FIRECRAWL:-true}' >> /app/entrypoint.sh && \
36
+ echo 'export NEXT_PUBLIC_ENABLE_WEBSITE_WATERCRAWL=${ENABLE_WEBSITE_WATERCRAWL:-true}' >> /app/entrypoint.sh && \
37
+ echo 'export NEXT_PUBLIC_LOOP_NODE_MAX_COUNT=${LOOP_NODE_MAX_COUNT}' >> /app/entrypoint.sh && \
38
+ echo 'export NEXT_PUBLIC_MAX_PARALLEL_LIMIT=${MAX_PARALLEL_LIMIT}' >> /app/entrypoint.sh && \
39
+ echo 'export NEXT_PUBLIC_MAX_ITERATIONS_NUM=${MAX_ITERATIONS_NUM}' >> /app/entrypoint.sh && \
40
+ echo 'pm2 start /app/web/server.js --name dify-web --cwd /app/web -i ${PM2_INSTANCES} --no-daemon' >> /app/entrypoint.sh && \
41
+ chmod +x /app/entrypoint.sh
42
 
43
  # 配置环境变量
44
  ENV NEXT_TELEMETRY_DISABLED=0 \
 
64
  EXPOSE 3000
65
 
66
  # 设置入口点
67
+ ENTRYPOINT ["/app/entrypoint.sh"]