Fix Docker startup install for externally managed Python environment.

Install python3-venv and move backend dependency installation/runtime to a dedicated venv to avoid PEP 668 pip errors inside Debian-based container.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
renjue
2026-05-09 16:43:11 +08:00
parent 3ed3d34900
commit ddbd79b951
2 changed files with 7 additions and 3 deletions

View File

@@ -18,7 +18,11 @@ else
fi
echo "[start] installing backend dependencies"
python3 -m pip install --no-cache-dir -r "${WORKTREE_DIR}/backend/requirements.txt"
VENV_DIR="${WORKTREE_DIR}/.venv"
if [ ! -x "${VENV_DIR}/bin/python" ]; then
python3 -m venv "${VENV_DIR}"
fi
"${VENV_DIR}/bin/pip" install --no-cache-dir -r "${WORKTREE_DIR}/backend/requirements.txt"
echo "[start] installing frontend dependencies and building"
cd "${WORKTREE_DIR}/frontend"
@@ -27,7 +31,7 @@ npm run build
echo "[start] launching backend:${BACKEND_PORT} and frontend:${FRONTEND_PORT}"
cd "${WORKTREE_DIR}/backend"
python3 app.py &
"${VENV_DIR}/bin/python" app.py &
BACKEND_PID=$!
cd "${WORKTREE_DIR}/frontend"