fix(docker): 生产镜像安装 rsync 修复文件推送失败
容器内缺少 rsync/openssh-client/sshpass,_rsync_push 触发 FileNotFoundError。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+5
-1
@@ -2,7 +2,11 @@
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
openssh-client \
|
||||
rsync \
|
||||
sshpass \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
+5
-1
@@ -16,7 +16,11 @@ RUN npx vite build
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
openssh-client \
|
||||
rsync \
|
||||
sshpass \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Changelog — 2026-06-07 Docker 镜像补 rsync 修复文件推送
|
||||
|
||||
## 摘要
|
||||
|
||||
生产 Docker 镜像未安装 `rsync`(及 SSH 依赖),导致 `#/push` 执行 `POST /api/sync/files` 时在 `_rsync_push` 抛出 `FileNotFoundError: [Errno 2] No such file or directory`,日志表现为 `sync_files worker raised` 与 `2/2 servers missing results`。
|
||||
|
||||
## 动机
|
||||
|
||||
用户反馈「推送失败」;容器日志确认 `asyncio.create_subprocess_exec("rsync", ...)` 找不到可执行文件,与源/目标路径配置无关。
|
||||
|
||||
## 变更
|
||||
|
||||
- `Dockerfile.prod`:apt 安装 `rsync`、`openssh-client`、`sshpass`(与 `sync_engine_v2._rsync_push` 一致)
|
||||
- `Dockerfile`:同上,本地 Docker 开发与生产行为对齐
|
||||
|
||||
## 涉及文件
|
||||
|
||||
- `Dockerfile.prod`
|
||||
- `Dockerfile`
|
||||
|
||||
## 迁移 / 重启
|
||||
|
||||
- **需重建镜像并重启 API 容器**(`docker compose build` + `up -d`)
|
||||
- 无数据库迁移
|
||||
|
||||
## 验证
|
||||
|
||||
```bash
|
||||
docker exec nexus-prod-nexus-1 which rsync ssh sshpass
|
||||
# 推送页选暂存目录 + 目标服务器 → POST /api/sync/files 应返回 task_id,sync_logs 无 FileNotFoundError
|
||||
```
|
||||
Reference in New Issue
Block a user