Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 1.62 KB

LOCAL.md

File metadata and controls

78 lines (55 loc) · 1.62 KB

本地部署

配置

1. 服务器配置CONFIG_PATH

{
  "database": {
    "type": "local",// memory, local, sqlite, redis
    "path": "/app/data.json" // your database path
  },
  "server": { //  server configuration for webhook mode
    "hostname": "0.0.0.0",
    "port": 3000, // must 8787 when using docker
    "baseURL": "https://example.com"
  },
  'proxy': 'http://127.0.0.1:7890', // proxy for telegram api
  "mode": "webhook", // webhook, polling
}

2. toml 配置TOML_PATH

toml 内容与cloudflare workers配置文件兼容

本地运行

pnpm install
pnpm run start:local

or

pnpm install
pnpm run build:local
CONFIG_PATH=./config.json TOML_PATH=./wrangler.toml pnpm run start:dist

Docker 运行

1. 编译image

docker build -t chatgpt-telegram-workers:latest .

or

pnpm run build:docker # 更快(直接使用本地构建的结果创建镜像)

2. 运行容器

docker run -d -p 8787:8787 -v $(pwd)/config.json:/app/config.json:ro -v $(pwd)/wrangler.toml:/app/config.toml:ro chatgpt-telegram-workers:latest

docker-compose 运行

自行修改docker-compose.yml中的配置文件路径

docker-compose up # edit the docker-compose.yml to change the config file path

使用Docker hub镜像

https://github.com/TBXark/ChatGPT-Telegram-Workers/pkgs/container/chatgpt-telegram-workers

docker pull ghcr.io/tbxark/chatgpt-telegram-workers:latest
docker run -d -p 8787:8787 -v $(pwd)/config.json:/app/config.json:ro -v $(pwd)/wrangler.toml:/app/config.toml:ro ghcr.io/tbxark/chatgpt-telegram-workers:latest