Sign inSign up

ocpub/oc9-dify

By ocpub

Updated 4 months ago

Image
0

739

ocpub/oc9-dify repository overview

Dify on OpenCloudOS 9

基本信息

  • 框架版本:Dify v1.14.2
  • 基础镜像opencloudos/opencloudos9-cuda-devel:12.8
  • Python 版本:3.11
  • CUDA 版本:12.8
  • Node.js 版本:22
  • Plugin Daemon 版本0.6.1-local
  • 镜像模式:单镜像,多角色容器运行

该镜像合并了以下 Dify 组件:

api
worker
beat
web
plugin_daemon

不包含以下外部依赖:

PostgreSQL
Redis
Nginx
向量数据库
sandbox
ssrf_proxy

构建

docker build -t oc9-dify:1.14.2 .

也可以显式指定版本:

docker build \
  --build-arg DIFY_VERSION=1.14.2 \
  --build-arg PLUGIN_DAEMON_VERSION=0.6.1-local \
  -t oc9-dify:1.14.2 .

使用示例

查看 Python 版本:

docker run --rm oc9-dify:1.14.2 \
  python --version

查看 Dify 后端虚拟环境 Python:

docker run --rm --entrypoint bash oc9-dify:1.14.2 \
  -c "/app/api/.venv/bin/python --version"

查看 Node.js 版本:

docker run --rm --entrypoint bash oc9-dify:1.14.2 \
  -c "node --version"

查看角色启动入口:

docker run --rm oc9-dify:1.14.2

默认启动:

ROLE=api

运行方式

该镜像通过 ROLE 环境变量区分启动角色。

启动 API
docker run -d \
  --name dify-api \
  -e ROLE=api \
  -e DB_HOST=<postgres-host> \
  -e DB_PORT=5432 \
  -e DB_USERNAME=dify \
  -e DB_PASSWORD=<password> \
  -e DB_DATABASE=dify \
  -e REDIS_HOST=<redis-host> \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=<redis-password> \
  -p 5001:5001 \
  oc9-dify:1.14.2
启动 Worker
docker run -d \
  --name dify-worker \
  -e ROLE=worker \
  -e DB_HOST=<postgres-host> \
  -e DB_PORT=5432 \
  -e DB_USERNAME=dify \
  -e DB_PASSWORD=<password> \
  -e DB_DATABASE=dify \
  -e REDIS_HOST=<redis-host> \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=<redis-password> \
  oc9-dify:1.14.2
启动 Beat
docker run -d \
  --name dify-beat \
  -e ROLE=beat \
  -e DB_HOST=<postgres-host> \
  -e DB_PORT=5432 \
  -e DB_USERNAME=dify \
  -e DB_PASSWORD=<password> \
  -e DB_DATABASE=dify \
  -e REDIS_HOST=<redis-host> \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=<redis-password> \
  oc9-dify:1.14.2
启动 Web
docker run -d \
  --name dify-web \
  -e ROLE=web \
  -e CONSOLE_API_URL=http://<api-host>:5001 \
  -e APP_API_URL=http://<api-host>:5001 \
  -p 3000:3000 \
  oc9-dify:1.14.2
启动 Plugin Daemon
docker run -d \
  --name dify-plugin-daemon \
  -e ROLE=plugin_daemon \
  -e DB_HOST=<postgres-host> \
  -e DB_PORT=5432 \
  -e DB_USERNAME=dify \
  -e DB_PASSWORD=<password> \
  -e DB_DATABASE=dify_plugin \
  -e DB_SSL_MODE=disable \
  -e REDIS_HOST=<redis-host> \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=<redis-password> \
  -e SERVER_PORT=5002 \
  -e SERVER_KEY=<plugin-server-key> \
  -e DIFY_INNER_API_URL=http://<api-host>:5001 \
  -e DIFY_INNER_API_KEY=<inner-api-key> \
  -e PLUGIN_WORKING_PATH=/app/storage/cwd \
  -e PLUGIN_STORAGE_LOCAL_ROOT=/app/storage \
  -v ./volumes/plugin_daemon:/app/storage \
  -p 5002:5002 \
  -p 5003:5003 \
  oc9-dify:1.14.2

docker-compose 示例

services:
  api:
    image: oc9-dify:1.14.2
    environment:
      ROLE: api
      DB_HOST: postgres
      DB_PORT: 5432
      DB_USERNAME: dify
      DB_PASSWORD: dify
      DB_DATABASE: dify
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: redis
      PLUGIN_DAEMON_URL: http://plugin_daemon:5002
      INNER_API_KEY_FOR_PLUGIN: change-this-key
    ports:
      - "5001:5001"
    volumes:
      - ./volumes/app/storage:/app/api/storage

  worker:
    image: oc9-dify:1.14.2
    environment:
      ROLE: worker
      DB_HOST: postgres
      DB_PORT: 5432
      DB_USERNAME: dify
      DB_PASSWORD: dify
      DB_DATABASE: dify
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: redis
      INNER_API_KEY_FOR_PLUGIN: change-this-key
    volumes:
      - ./volumes/app/storage:/app/api/storage

  beat:
    image: oc9-dify:1.14.2
    environment:
      ROLE: beat
      DB_HOST: postgres
      DB_PORT: 5432
      DB_USERNAME: dify
      DB_PASSWORD: dify
      DB_DATABASE: dify
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: redis

  web:
    image: oc9-dify:1.14.2
    environment:
      ROLE: web
      CONSOLE_API_URL: http://localhost:5001
      APP_API_URL: http://localhost:5001
    ports:
      - "3000:3000"

  plugin_daemon:
    image: oc9-dify:1.14.2
    environment:
      ROLE: plugin_daemon
      DB_HOST: postgres
      DB_PORT: 5432
      DB_USERNAME: dify
      DB_PASSWORD: dify
      DB_DATABASE: dify_plugin
      DB_SSL_MODE: disable
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: redis
      SERVER_PORT: 5002
      SERVER_KEY: change-this-plugin-key
      DIFY_INNER_API_URL: http://api:5001
      DIFY_INNER_API_KEY: change-this-key
      PLUGIN_WORKING_PATH: /app/storage/cwd
      PLUGIN_STORAGE_LOCAL_ROOT: /app/storage
    volumes:
      - ./volumes/plugin_daemon:/app/storage
    ports:
      - "5002:5002"
      - "5003:5003"

已知问题

  • 该镜像不包含 PostgreSQL、Redis、向量数据库、sandbox、ssrf_proxy,需要外部提供。
  • apiworkerbeatwebplugin_daemon 必须使用同一个 Dify 版本构建。
  • plugin_daemon 版本必须与官方 compose 对齐,Dify 1.14.2 对应 0.6.1-local
  • 插件目录 /app/storage 必须持久化,否则插件安装状态可能丢失。
  • Web 服务需要正确配置 CONSOLE_API_URLAPP_API_URL
  • Dify 后端默认不需要 CUDA,也不依赖 torch;CUDA 主要用于你额外部署本地模型、embedding 或 rerank 服务。
  • 生产环境建议仍使用外部 Nginx 或网关统一暴露 Web/API。
Dify镜像版本与plugin_daemon版本对应
Dify 版本plugin-daemon 版本
1.11.30.5.2-local
1.11.40.5.2-local
1.12.00.5.3-local
1.12.10.5.3-local
1.13.00.5.3-local
1.13.10.5.4-local
1.13.20.5.4-local
1.13.30.5.3-local
1.14.10.6.0-local
1.14.20.6.1-local
版本之间真正的区别(部署角度)
版本特征是否推荐生产
1.11.3插件体系稳定化开始
1.11.4安全修复版推荐
1.12.0Summary Index 大升级谨慎
1.12.1修复 1.12 问题推荐
1.13.0Agent 架构升级
1.13.1Worker/plugin 修复推荐
1.13.2稳定性修复推荐
1.13.31.13 最稳定版强烈推荐
1.14.1企业化增强推荐
1.14.2当前最稳定最推荐

数据库兼容性(很重要)

1.11 ——> 1.12 风险很大

知识库 schema
索引 schema

变化明显

Tag summary

Content type

Image

Digest

sha256:e82b39185

Size

8.8 GB

Last updated

4 months ago

docker pull ocpub/oc9-dify:1.14.2