feat: ship astrbot CLI in Docker image for in-container password reset

Install the project itself into the image so the `astrbot` console
script (including `astrbot password` and `astrbot conf set`) is
available inside the container, and mark /AstrBot as an initialized
AstrBot root via the .astrbot marker file.

This lets Docker users reset a forgotten dashboard password with:

    docker exec -it astrbot astrbot password

Document the workflow in the zh/en Docker deployment guides, including
the required container restart for the new password to take effect.
This commit is contained in:
Soulter
2026-10-07 23:15:06 +08:00
parent 8831d95025
commit c2c260b88f
3 changed files with 37 additions and 1 deletions
+3 -1
View File
@@ -28,7 +28,9 @@ RUN python -m pip install uv \
&& uv lock \
&& uv export --format requirements.txt --output-file requirements.txt --frozen \
&& uv pip install -r requirements.txt --no-cache-dir --system \
&& uv pip install socksio uv pilk --no-cache-dir --system
&& uv pip install socksio uv pilk --no-cache-dir --system \
&& uv pip install . --no-deps --no-cache-dir --system \
&& touch /AstrBot/.astrbot
EXPOSE 6185
+17
View File
@@ -125,6 +125,23 @@ If there are no errors, you will see a log message similar to `🌈 Dashboard st
Next, you need to deploy any messaging platform to use AstrBot on that platform.
## Reset the Dashboard Password
If you forget the dashboard password, you can reset it with the built-in AstrBot CLI inside the container:
```bash
sudo docker exec -it astrbot astrbot password
```
Follow the prompt to enter a new password. To also change the username:
```bash
sudo docker exec -it astrbot astrbot password --username <new-username>
```
> [!TIP]
> The new password takes effect after restarting the container: `sudo docker restart astrbot`.
## Configure an HTTP proxy in Docker
Set the HTTP proxy in the WebUI under `Settings → Network → Proxy & Dependency Sources → HTTP Proxy`. AstrBot reaches that address **from inside its own container**, so `http://127.0.0.1:7890` points at the AstrBot container itself rather than the host or another container.
+17
View File
@@ -141,6 +141,23 @@ docker run -itd -p 6185:6185 -p 6199:6199 -e TZ=Asia/Shanghai -v "${PWD}\data:/A
接下来,你需要部署任何一个消息平台,才能够实现在消息平台上使用 AstrBot。
## 重置 Dashboard 密码
如果忘记了 Dashboard 密码,可以通过容器内置的 AstrBot CLI 重置:
```bash
sudo docker exec -it astrbot astrbot password
```
按提示输入新密码即可。如需同时修改用户名:
```bash
sudo docker exec -it astrbot astrbot password --username <新用户名>
```
> [!TIP]
> 修改后需要重启容器才能生效:`sudo docker restart astrbot`。
## 在 Docker 中配置 HTTP 代理
AstrBot 的 HTTP 代理在 WebUI:`设置 → 网络 → 代理与依赖源 → HTTP 代理`。填写的地址由 **AstrBot 容器内部**访问,因此 `http://127.0.0.1:7890` 会连到 AstrBot 容器自己,而不是宿主机或其他容器。