Yunzai-Bot icon indicating copy to clipboard operation
Yunzai-Bot copied to clipboard

使用 Docker 部署项目(支持 v2 和 v3)

Open Xm798 opened this issue 2 years ago • 106 comments

为什么选择 docker ?

  • 开箱即用的云崽机器人,近乎一键安装,无需考虑 redis 和 nodejs 环境安装和依赖安装、项目更新等问题
  • 不会破坏主机环境,跑路时仅需删除 docker 容器即可
  • 毋庸担心本项目环境与本机其他项目所需要的环境相互干扰的问题
  • 可在任意支持 docker 的 amd64 架构或 arm64 架构的操作系统(包括Linux、Windows、MacOS等)上轻松运行
  • 结合 docker 部署脚本,可以交互式配置喵喵插件和Python插件,免除手动安装插件、配置环境和编译 ffmpeg 的烦恼
  • 所有用户数据均已映射到主机,方便备份和迁移
  • 每次重启容器即可完成对云崽本体和喵喵插件、Python 插件(若存在)的更新,方便快捷
  • 可配合 portainer 进行图形化管理
  • 可通过创建多个 service 轻松实现多开

镜像列表

目前,docker 镜像支持 v2 和 v3 的部署,每个版本镜像分为 精简版扩展版,精简版仅有云崽本体(可选加载喵喵插件和图鉴插件),扩展版附带 ffmpeg 环境和 Python 环境(可选加载 Python 插件)。

tag 云崽版本 类型 镜像托管
sirly/yunzai-bot:v3 v3 精简版 DockerHub
sirly/yunzai-bot:v3plus v3 扩展版 DockerHub
sirly/yunzai-bot:v2 v2 精简版 DockerHub
sirly/yunzai-bot:v2plus v2 扩展版 DockerHub
swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v3 v3 精简版 华为云
swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v3plus v3 扩展版 华为云
sswr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v2 v2 精简版 华为云
sswr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v2plus v2 扩展版 华为云

你可以在 SirlyDreamer/Yunzai-Bot 的不同分支中找到各对应版本的 Dockerfile。

部署说明

Docker 部署 | 文档中心

安装 Docker

Linux

使用一键脚本安装(荐)

curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
手动安装

Windows 和 Mac

请参考以下文档进行安装:

准备项目

辅助脚本(荐)

Linux 可使用一键辅助脚本创建所需文件夹并下载所需文件,并可选择是否安装插件。

# V3 版本
bash <(curl -sSL http://yunzai.org/install_v3)

# V2 版本
bash <(curl -sSL http://yunzai.org/install_v2)

手动准备(v2)

目前,Windows 暂时需要手动准备文件。

查看详情
  1. 新建一个工作文件夹,例如 yunzai-bot,用于存放运行项目的相关文件。

  2. 该步骤分为两种情况:本地构建镜像 和 使用现有镜像。使用现有镜像会直接拉取已经构建好的镜像,拥有更快的部署速度。本地构建镜像可以通过修改 Dockerfile 调整一些高级自定义项。

    使用现有镜像(荐)

    下载 docker-compose.yaml 到文件夹中。可根据需要更换镜像。

    本地构建镜像

    基础镜像:dockerdev 扩展镜像:dockerplus

  3. 在工作文件夹 yunzai-bot 中新建文件夹 yunzai,下载 config_default.js 放于其中,重命名为 config.js,并修改配置文件的内容为你自己的配置。配置文件中的 redis 的 host 填写 redis,不是127.0.0.1

    redis: {
        host: "redis", //redis地址
        port: 6379,        //redis端口
        password: "",      //redis密码,没有密码可以为空
        db: 0,             //redis数据库 
      },
    
  4. 如果需要映射插件、全局语音、全局表情等,在 docker-compose.yaml 文件中的 volumes 部分取消对应项的注释,并在 工作文件夹/Yunzai 中新建对应的文件夹用于存放文件,本地的路径需要跟 docker-compose.yaml 中冒号前面的路径一致。

运行项目

使用 cd yunzai-bot 进入工作目录。

首次运行

首次运行需要完成验证:

# 启动容器
docker-compose up -d
docker exec -it yunzai-bot node app

# -------------------------
# 验证完成后,按快捷键 Ctrl+C 退出,然后重启容器
docker-compose restart

常用命令

后台运行

docker-compose up -d

前台运行

docker-compose up

停止运行

docker-compose down

重启/更新

重启时会自动拉取最新项目并更新相关依赖

docker-compose restart

查看最后的100行日志并持续输出日志

docker-compose logs -f --tail=100

Xm798 avatar Apr 16 '22 14:04 Xm798

你做的好,你做的好啊!

Mulsd avatar Apr 16 '22 14:04 Mulsd

启动时出现错误 ERROR: The Compose file './docker-compose.yaml' is invalid because: services.redis.healthcheck value Additional properties are not allowed ('start_period' was unexpected) services.yunzai-bot.depends_on contains an invalid type, it should be an array

Lixuhuilll avatar May 11 '22 05:05 Lixuhuilll

docker-compose 换成 docker compose 就好了

Lixuhuilll avatar May 11 '22 06:05 Lixuhuilll

启动时出现错误 ERROR: The Compose file './docker-compose.yaml' is invalid because: services.redis.healthcheck value Additional properties are not allowed ('start_period' was unexpected) services.yunzai-bot.depends_on contains an invalid type, it should be an array

需要更多的信息:

  1. 操作系统
  2. docker-compose 版本,通过 docker-compose version 查看

docker-compose 换成 docker compose 就好了

那是不是 docker-compose 版本过旧?

如果还想使用 docker-compose 可以尝试将 version: "3" 修改为 version: "3.9"观察是否能够解决问题。

Xm798 avatar May 11 '22 06:05 Xm798

需要更多的信息:

  1. 操作系统
  2. docker-compose 版本,通过 docker-compose version 查看

使用一键安装脚本安装的docker没有docker-compose指令,我自己装的二进制docker-compose文件有问题。 脚本自动安装的是docker compose 指令,这个没有任何问题,可以直接使用

Lixuhuilll avatar May 11 '22 07:05 Lixuhuilll

中间就差了一个 - 符号

Lixuhuilll avatar May 11 '22 07:05 Lixuhuilll

我还想问一下,如何实现多开呢。目前只能使用一个docker,多个会有冲突。

Lixuhuilll avatar May 11 '22 09:05 Lixuhuilll

这是尝试启动第二个bot时发生的错误 myyzbot-yunzai-bot-1 | [信息] 启动云崽-BOT
myyzbot-yunzai-bot-1 | ======== myyzbot-yunzai-bot-1 | myyzbot-yunzai-bot-1 | node:internal/errors:464 myyzbot-yunzai-bot-1 | ErrorCaptureStackTrace(err); myyzbot-yunzai-bot-1 | ^ myyzbot-yunzai-bot-1 | myyzbot-yunzai-bot-1 | Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/app/Yunzai-Bot/config/config.js' is not supported resolving ES modules imported from /app/Yunzai-Bot/lib/check.js myyzbot-yunzai-bot-1 | at new NodeError (node:internal/errors:371:5) myyzbot-yunzai-bot-1 | at finalizeResolution (node:internal/modules/esm/resolve:412:17) myyzbot-yunzai-bot-1 | at moduleResolve (node:internal/modules/esm/resolve:932:10) myyzbot-yunzai-bot-1 | at defaultResolve (node:internal/modules/esm/resolve:1044:11) myyzbot-yunzai-bot-1 | at ESMLoader.resolve (node:internal/modules/esm/loader:422:30) myyzbot-yunzai-bot-1 | at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40) myyzbot-yunzai-bot-1 | at ESMLoader.import (node:internal/modules/esm/loader:276:22) myyzbot-yunzai-bot-1 | at importModuleDynamically (node:internal/modules/esm/translators:111:35) myyzbot-yunzai-bot-1 | at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) myyzbot-yunzai-bot-1 | at check (file:///app/Yunzai-Bot/lib/check.js:22:25) { myyzbot-yunzai-bot-1 | code: 'ERR_UNSUPPORTED_DIR_IMPORT', myyzbot-yunzai-bot-1 | url: 'file:///app/Yunzai-Bot/config/config.js' myyzbot-yunzai-bot-1 | }

Lixuhuilll avatar May 11 '22 09:05 Lixuhuilll

我还想问一下,如何实现多开呢。目前只能使用一个docker,多个会有冲突。

如何多开的呢?可以描述一下多开的操作吗?

正确的方法应该是创建多个yunzai的service来实现多开,container name要不同。

Xm798 avatar May 11 '22 09:05 Xm798

我是直接将文件复制到另一个文件夹启动,似乎是redis的端口冲突了

Lixuhuilll avatar May 11 '22 09:05 Lixuhuilll

version: "3"
services:
  yunzai-bot_1:
    # build: . # 使用 Dockerfile 本地构建
    image: ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest   # 使用镜像
    restart: on-failure:5
    volumes:
      - ./Yunzai_1/config.js:/app/Yunzai-Bot/config/config.js # config.js 配置文件,配置文件中 redis 地址填写 "redis"
      - ./Yunzai_1/logs:/app/Yunzai-Bot/logs # 日志文件
      - ./Yunzai_1/data:/app/Yunzai-Bot/data # 数据文件
      # 以下目录映射有需要可创建对应文件夹,并自行取消注释。
      # - ./Yunzai_1/global_img:/app/Yunzai-Bot/resources/global_img         # 全局表情目录
      # - ./Yunzai_1/global_record:/app/Yunzai-Bot/resources/global_record   # 全局语音目录
      # - ./Yunzai_1/lib/example:/app/Yunzai-Bot/lib/example                 # 自定义js插件目录
      # - ./Yunzai_1/plugins:/app/Yunzai-Bot/plugins                         # 插件目录
    depends_on:
      redis: { condition: service_healthy }

  yunzai-bot_2:
    # build: . # 使用 Dockerfile 本地构建
    image: ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest   # 使用镜像
    restart: on-failure:5
    volumes:
      - ./Yunzai_2/config.js:/app/Yunzai-Bot/config/config.js # config.js 配置文件,配置文件中 redis 地址填写 "redis"
      - ./Yunzai_2/logs:/app/Yunzai-Bot/logs # 日志文件
      - ./Yunzai_2/data:/app/Yunzai-Bot/data # 数据文件
      # 以下目录映射有需要可创建对应文件夹,并自行取消注释。
      # - ./Yunzai_2/global_img:/app/Yunzai-Bot/resources/global_img         # 全局表情目录
      # - ./Yunzai_2/global_record:/app/Yunzai-Bot/resources/global_record   # 全局语音目录
      # - ./Yunzai_2/lib/example:/app/Yunzai-Bot/lib/example                 # 自定义js插件目录
      # - ./Yunzai_2/plugins:/app/Yunzai-Bot/plugins                         # 插件目录
    depends_on:
      redis: { condition: service_healthy }

  redis:
    image: "redis:alpine"
    restart: on-failure:5
    volumes:
      - ./redis/data:/data
      - ./redis/logs:/logs
    healthcheck:
      test: ["CMD", "redis-cli", "PING"]
      start_period: 10s
      interval: 5s
      timeout: 1s

尝试一下

Xm798 avatar May 11 '22 09:05 Xm798

需要更多的信息:

  1. 操作系统
  2. docker-compose 版本,通过 docker-compose version 查看

使用一键安装脚本安装的docker没有docker-compose指令,我自己装的二进制docker-compose文件有问题。 脚本自动安装的是docker compose 指令,这个没有任何问题,可以直接使用

请问您自己安装的docker-compose二进制的版本是多少,是否是从linux发行版的软件源下载的?

如果是从linux发行版的包管理器下载,请卸载并按照官方方案安装,官方安装docker-compose的方法在https://docs.docker.com/compose/install/

如果不是,请告知您的docker-compose版本,以方便我进行测试,谢谢

SirlyDreamer avatar May 19 '22 08:05 SirlyDreamer

在我node app的时候出现以下报错

[root@9eabdea45db6 Yunzai-Bot]# node app
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/app/Yunzai-Bot/config/config.js' is not supported resolving ES modules imported from /app/Yunzai-Bot/lib/check.js
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:412:17)
    at moduleResolve (node:internal/modules/esm/resolve:932:10)
    at defaultResolve (node:internal/modules/esm/resolve:1044:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
    at ESMLoader.import (node:internal/modules/esm/loader:276:22)
    at importModuleDynamically (node:internal/modules/esm/translators:111:35)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
    at check (file:///app/Yunzai-Bot/lib/check.js:22:25) {
  code: 'ERR_UNSUPPORTED_DIR_IMPORT',
  url: 'file:///app/Yunzai-Bot/config/config.js'
}

docker-compose版本

[root@VM-12-5-centos Yunzai-Bot]# docker-compose -version
docker-compose version 1.27.2, build 18f557f9

keaiye avatar Jun 05 '22 14:06 keaiye

在我node app的时候出现以下报错

[root@9eabdea45db6 Yunzai-Bot]# node app
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^
......

上面有一个相同的报错,你看看是不是因为你多开了?

Mulsd avatar Jun 05 '22 14:06 Mulsd

在我node app的时候出现以下报错

[root@9eabdea45db6 Yunzai-Bot]# node app
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^
......

上面有一个相同的报错,你看看是不是因为你多开了?

没有多开哦,我百度了一下,好像是/app/Yunzai-Bot/lib/check.js里的config.js导入方式有问题

keaiye avatar Jun 05 '22 15:06 keaiye

在我node app的时候出现以下报错

[root@9eabdea45db6 Yunzai-Bot]# node app
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^
......

上面有一个相同的报错,你看看是不是因为你多开了?

没有多开哦,我百度了一下,好像是/app/Yunzai-Bot/lib/check.js里的config.js导入方式有问题

请检查同目录下Yunzai文件夹中有没有config.js文件(用vim能正常打开并显示内容),如果不能正常打开则需要先删除并重新建立config.js(不是config_default.js)文件,如果没问题,请检查docker-compose.yml文件

  volumes:
      - ./Yunzai/config.js:/app/Yunzai-Bot/config/config.js # config.js 配置文件,配置文件中 redis 地址填写 "redis"
      - ./Yunzai/logs:/app/Yunzai-Bot/logs # 日志文件
      - ./Yunzai/data:/app/Yunzai-Bot/data # 数据文件
      # 以下目录映射有需要可创建对应文件夹,并自行取消注释。
      # - ./Yunzai/global_img:/app/Yunzai-Bot/resources/global_img         # 全局表情目录
      # - ./Yunzai/global_record:/app/Yunzai-Bot/resources/global_record   # 全局语音目录
      # - ./Yunzai/lib/example:/app/Yunzai-Bot/lib/example                 # 自定义js插件目录
      # - ./Yunzai/plugins:/app/Yunzai-Bot/plugins                         # 插件目录

中前三项有没有被注释,如果有请取消

SirlyDreamer avatar Jun 06 '22 02:06 SirlyDreamer

启动报错 node:internal/errors:464 stderr: ErrorCaptureStackTrace(err); stderr: ^ stderr: stderr: Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/app/Yunzai-Bot/config/config.js' is not supported resolving ES modules imported from /app/Yunzai-Bot/lib/check.js stderr: at new NodeError (node:internal/errors:371:5) stderr: at finalizeResolution (node:internal/modules/esm/resolve:412:17) stderr: at moduleResolve (node:internal/modules/esm/resolve:932:10) stderr: at defaultResolve (node:internal/modules/esm/resolve:1044:11) stderr: at ESMLoader.resolve (node:internal/modules/esm/loader:422:30) stderr: at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40) stderr: at ESMLoader.import (node:internal/modules/esm/loader:276:22) stderr: at importModuleDynamically (node:internal/modules/esm/translators:111:35) stderr: at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) stderr: at check (file:///app/Yunzai-Bot/lib/check.js:22:25) { stderr: code: 'ERR_UNSUPPORTED_DIR_IMPORT', stderr: url: 'file:///app/Yunzai-Bot/config/config.js'

MIUKUKANO avatar Jun 07 '22 10:06 MIUKUKANO

启动报错 node:internal/errors:464 stderr: ErrorCaptureStackTrace(err); stderr: ^ stderr: stderr: Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/app/Yunzai-Bot/config/config.js' is not supported resolving ES modules imported from /app/Yunzai-Bot/lib/check.js stderr: at new NodeError (node:internal/errors:371:5) stderr: at finalizeResolution (node:internal/modules/esm/resolve:412:17) stderr: at moduleResolve (node:internal/modules/esm/resolve:932:10) stderr: at defaultResolve (node:internal/modules/esm/resolve:1044:11) stderr: at ESMLoader.resolve (node:internal/modules/esm/loader:422:30) stderr: at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40) stderr: at ESMLoader.import (node:internal/modules/esm/loader:276:22) stderr: at importModuleDynamically (node:internal/modules/esm/translators:111:35) stderr: at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) stderr: at check (file:///app/Yunzai-Bot/lib/check.js:22:25) { stderr: code: 'ERR_UNSUPPORTED_DIR_IMPORT', stderr: url: 'file:///app/Yunzai-Bot/config/config.js'

和上面的是一种类型,请检查文件

SirlyDreamer avatar Jun 07 '22 10:06 SirlyDreamer

你好,求助一下,执行docker-compose up -d后容器启动不起来 容器日志如下,docker-entrypoint.sh文件跟Dockerfile在同一个目录下 [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker logs c2dd9fddc7c7 exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# ls docker-compose.yaml docker-entrypoint.sh Dockerfile get-docker.sh redis Yunzai 使用镜像ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest也是 [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker logs d2a48c3fab8a exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d2a48c3fab8a ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest "./entrypoint.sh" 25 seconds ago Restarting (1) 7 seconds ago yunzai-yunzai-bot-1 da0033104b01 redis:alpine "docker-entrypoint.s…" 25 minutes ago Up 25 minutes (healthy) 6379/tcp yunzai-redis-1

shi2674737 avatar Jun 10 '22 08:06 shi2674737

你好,求助一下,执行docker-compose up -d后容器启动不起来 容器日志如下,docker-entrypoint.sh文件跟Dockerfile在同一个目录下 [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker logs c2dd9fddc7c7 exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# ls docker-compose.yaml docker-entrypoint.sh Dockerfile get-docker.sh redis Yunzai 使用镜像ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest也是 [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker logs d2a48c3fab8a exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d2a48c3fab8a ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest "./entrypoint.sh" 25 seconds ago Restarting (1) 7 seconds ago yunzai-yunzai-bot-1 da0033104b01 redis:alpine "docker-entrypoint.s…" 25 minutes ago Up 25 minutes (healthy) 6379/tcp yunzai-redis-1

重新 pull 一下镜像,现在可以了,刚才镜像有点问题。

docker-compose pull 或者 docker pull ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest

Xm798 avatar Jun 10 '22 08:06 Xm798

你好,求助一下,执行docker-compose up -d后容器启动不起来 容器日志如下,docker-entrypoint.sh文件跟Dockerfile在同一个目录下 [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker logs c2dd9fddc7c7 exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory exec ./entrypoint.sh: no such file or directory [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# ls docker-compose.yaml docker-entrypoint.sh Dockerfile get-docker.sh redis Yunzai 使用镜像ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest也是 [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker logs d2a48c3fab8a exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error exec ./entrypoint.sh: exec format error [root@iZ8vb4yg0gndvh744uiy1pZ yunzai]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d2a48c3fab8a ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest "./entrypoint.sh" 25 seconds ago Restarting (1) 7 seconds ago yunzai-yunzai-bot-1 da0033104b01 redis:alpine "docker-entrypoint.s…" 25 minutes ago Up 25 minutes (healthy) 6379/tcp yunzai-redis-1

重新 pull 一下镜像,现在可以了,刚才镜像有点问题。

docker-compose pull 或者 docker pull ccr.ccs.tencentyun.com/xm798/yunzai-bot:latest

已经可以了,谢谢

shi2674737 avatar Jun 10 '22 09:06 shi2674737

有没有可能把python集成进去,这样可以运行python-plugin,功能还是挺多的。今天自己在容器里试了一下,依赖环境可以通过apk add和pip装上,但是python的entrypoint不知该怎么调整,/bin/sh下没法执行python程序。

OctoberCK avatar Jun 10 '22 12:06 OctoberCK

有没有可能把python集成进去,这样可以运行python-plugin,功能还是挺多的。今天自己在容器里试了一下,依赖环境可以通过apk add和pip装上,但是python的entrypoint不知该怎么调整,/bin/sh下没法执行python程序。

换成#!/bin/ash就行了,你可以自己调整。

SirlyDreamer avatar Jun 10 '22 12:06 SirlyDreamer

有没有可能把python集成进去,这样可以运行python-plugin,功能还是挺多的。今天自己在容器里试了一下,依赖环境可以通过apk add和pip装上,但是python的entrypoint不知该怎么调整,/bin/sh下没法执行python程序。

换成#!/bin/ash就行了,你可以自己调整。

在ash下好像也不能运行python命令,提示not found,python已经装好了的。

OctoberCK avatar Jun 10 '22 15:06 OctoberCK

有没有可能把python集成进去,这样可以运行python-plugin,功能还是挺多的。今天自己在容器里试了一下,依赖环境可以通过apk add和pip装上,但是python的entrypoint不知该怎么调整,/bin/sh下没法执行python程序。

换成#!/bin/ash就行了,你可以自己调整。

在ash下好像也不能运行python命令,提示not found,python已经装好了的。

考虑到alpine没有glibc不适合运行python程序(因为没有轮子可以用,得自己编译库)。我的建议是更换底层镜像另行做python支持(可莉想出去玩,不想坐在电脑前慢慢敲代码o(TヘTo)~)

SirlyDreamer avatar Jun 11 '22 03:06 SirlyDreamer

有没有可能把python集成进去,这样可以运行python-plugin,功能还是挺多的。今天自己在容器里试了一下,依赖环境可以通过apk add和pip装上,但是python的entrypoint不知该怎么调整,/bin/sh下没法执行python程序。

已更新支持,镜像地址:swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:plus

SirlyDreamer avatar Jun 18 '22 13:06 SirlyDreamer

有没有可能把python集成进去,这样可以运行python-plugin,功能还是挺多的。今天自己在容器里试了一下,依赖环境可以通过apk add和pip装上,但是python的entrypoint不知该怎么调整,/bin/sh下没法执行python程序。

已更新支持,镜像地址:swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:plus

谢谢佬,tql。

OctoberCK avatar Jun 18 '22 14:06 OctoberCK

系统版本:Ubuntu Server 20.04 LTS 64bit Docker版本:Docker Compose version v2.6.0

刚开始就一直报下面这个错: 创建所需文件夹... /dev/fd/63: line 63: cd: /dev/fd/yunzai-bot/: No such file or directory

请问大佬有什么办法么,我用WinScp手动创建这个文件夹也提示目录不存在

ImHeroZero avatar Jun 19 '22 15:06 ImHeroZero

系统版本:Ubuntu Server 20.04 LTS 64bit

Docker版本:Docker Compose version v2.6.0

刚开始就一直报下面这个错:

创建所需文件夹...

/dev/fd/63: line 63: cd: /dev/fd/yunzai-bot/: No such file or directory

请问大佬有什么办法么,我用WinScp手动创建这个文件夹也提示目录不存在

手动 mkdir /dev/fd/yunzai-bot/

cd /dev/fd 进入 /dev/fd/ ,用 ls -lah 看一下有没有这个文件夹

Xm798 avatar Jun 19 '22 15:06 Xm798

root@VM-4-17-ubuntu:/dev/fd# mkdir /dev/fd/yunzai-bot/ mkdir: cannot create directory ‘/dev/fd/yunzai-bot/’: No such file or directory

无法创建,而且ls -lah出来的是这个 root@VM-4-17-ubuntu:/dev/fd# ls -lah total 0 dr-x------ 2 root root 0 Jun 20 00:05 . dr-xr-xr-x 9 root root 0 Jun 20 00:05 .. lrwx------ 1 root root 64 Jun 20 00:05 0 -> /dev/pts/0 lrwx------ 1 root root 64 Jun 20 00:05 1 -> /dev/pts/0 lrwx------ 1 root root 64 Jun 20 00:05 2 -> /dev/pts/0 lrwx------ 1 root root 64 Jun 20 00:06 255 -> /dev/pts/0

ImHeroZero avatar Jun 19 '22 16:06 ImHeroZero