#!/bin/sh # 创建配置目录 mkdir -p ~/.nanobot mkdir -p ~/.nanobot/workspace mkdir -p /tmp/agent_slots echo $PATH #echo "149.154.166.110 api.telegram.org" | tee -a /etc/hosts #apt install dnsutils -y #dig api.telegram.org #dig discord.com/api/v10 cat /dev/null >/etc/resolv.conf cat <> /etc/resolv.conf nameserver 1.1.1.1 nameserver 8.8.8.8 nameserver 2606:4700:4700::1111 nameserver 2606:4700:4700::1001 EOF #dig api.telegram.org #dig discord.com/api/v10 # 直接写入配置(对接你本地的 PowerServe 或 Ollama API) cat < ~/.nanobot/config.json { "providers": { "vllm": { "apiKey": "dummy", "apiBase": "http://localhost:7860/v1" } }, "agents": { "defaults": { "workspace": "~/.nanobot/workspace", "model": "vllm/qwen3-30ba3b" } }, "channels": { "telegram": { "enabled": true , "token": "$TG_TOKEN" , "allowFrom": ["$TG_ID"] }, "discord": { "enabled": false , "token": "$DC_TOKEN", "allowFrom": ["$DC_ID"] } } } EOF curl -Lo /usr/local/bin/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 && \ chmod +x /usr/local/bin/ttyd # 修改 entrypoint.sh 中的 ttyd 启动命令 ttyd bash & #sh /app/test.sh &&sleep 80 apt install wget sudo -y wget -q https://github.com/v2rayA/v2rayA/releases/download/v2.3.2/installer_debian_x64_2.3.2.deb && \ wget -q https://raw.githubusercontent.com/v2rayA/v2raya-apt/refs/heads/master/pool/main/x/xray/xray_25.8.3_amd64.deb && \ apt update && apt-get install -y ./installer_debian_x64_2.3.2.deb ./xray_25.8.3_amd64.deb && \ rm installer_debian_x64_2.3.2.deb && rm xray_25.8.3_amd64.deb #bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install #curl -s https://install.zerotier.com | bash #zerotier-cli join 8d1c312afaa97775 v2raya --lite & #curl -I https://discord.com #curl -Iv https://api.telegram.org export ALL_PROXY="socks5://20170" echo "Starting Python bot on port 8888..." # ~/.local/bin/nanobot gateway -p 8888 & ~/.local/bin/nanobot status #~/.local/bin/nanobot --help # 下载草稿模型 (建议用 Qwen2.5-1.5B-Instruct-GGUF 的 Q4_K_M 版本) echo "Downloading model..." # python3 -c "from huggingface_hub import hf_hub_download; \ # hf_hub_download(repo_id='byteshape/Qwen3-30B-A3B-Instruct-2507-GGUF', \ # filename='Qwen3-30B-A3B-Instruct-2507-Q4_K_S-3.61bpw.gguf', local_dir='/app')" # 1. 启动 C++ 服务 (llama-server) # 将端口改为 8080,并放到后台 echo "Starting llama-server on port 8080..." # ./llama-server -m "/app/Qwen3-30B-A3B-Instruct-2507-Q4_K_S-3.61bpw.gguf" --host "localhost" --port "7860" \ # -t "2" -c "16384" --flash-attn "on" --no-mmap -ctk q4_0 -ctv q4_0 & #date #echo "Current nanobot version: $(pip show nanobot)" # 4. 启动 Nginx 作为主进程 (监听 7860) # daemon off 确保容器不会立即退出 echo "Starting Nginx reverse proxy on port 7860..." nginx -g "daemon off;"