From e45ebd96a0ef9d9cb6136e36fa693e68a1b854a9 Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Sat, 13 Dec 2025 00:39:09 -0500 Subject: [PATCH] Add Python support with uv package manager in Docker container --- Dockerfile | 8 ++++++++ backend/src/index.ts | 8 ++++++++ .../src/components/message/PromptInput.tsx | 2 +- scripts/docker-entrypoint.sh | 19 ++++++++++++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8d03c859..aad775d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ RUN apt-get update && apt-get install -y \ less \ tree \ file \ + python3 \ + python3-pip \ + python3-venv \ && rm -rf /var/lib/apt/lists/* RUN corepack enable && corepack prepare pnpm@9.15.0 --activate @@ -25,6 +28,11 @@ RUN curl -fsSL https://bun.sh/install | bash && \ chmod -R 755 /opt/bun && \ ln -s /opt/bun/bin/bun /usr/local/bin/bun +RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \ + mv /root/.local/bin/uv /usr/local/bin/uv && \ + mv /root/.local/bin/uvx /usr/local/bin/uvx && \ + chmod +x /usr/local/bin/uv /usr/local/bin/uvx + WORKDIR /app FROM base AS deps diff --git a/backend/src/index.ts b/backend/src/index.ts index 68ce7cee..d23f107b 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -59,11 +59,19 @@ Always bind to \`0.0.0.0\` to allow external access from the Docker host. ## Package Management +### Node.js Packages Prefer **pnpm** or **bun** over npm for installing dependencies to save disk space: - Use \`pnpm install\` instead of \`npm install\` - Use \`bun install\` as an alternative - Both are pre-installed in the container +### Python Packages +Prefer **uv** for Python package management: +- Use \`uv venv\` to create virtual environments instead of \`python -m venv\` +- Use \`uv pip install\` to install packages instead of \`pip install\` +- Use \`uv pip\` for all pip operations +- uv is pre-installed in the container and provides faster package installation + ## General Guidelines - This file is merged with any AGENTS.md files in individual repositories diff --git a/frontend/src/components/message/PromptInput.tsx b/frontend/src/components/message/PromptInput.tsx index 4161ffe8..18eda291 100644 --- a/frontend/src/components/message/PromptInput.tsx +++ b/frontend/src/components/message/PromptInput.tsx @@ -491,7 +491,7 @@ export function PromptInput({ return (
{hasActiveStream && ( -
+
)} diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index 16ee0a51..afb54204 100644 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -3,7 +3,7 @@ set -e export HOME=/home/node export BUN_INSTALL="$HOME/.bun" -export PATH="$BUN_INSTALL/bin:$HOME/.opencode/bin:$HOME/.local/bin:$PATH" +export PATH="$BUN_INSTALL/bin:$HOME/.opencode/bin:$HOME/.local/bin:/usr/local/bin:$PATH" echo "🔍 Checking Bun installation..." @@ -22,6 +22,23 @@ else echo "✅ Bun is installed (version: $BUN_VERSION)" fi +echo "🔍 Checking uv installation..." + +if ! command -v uv >/dev/null 2>&1; then + echo "❌ uv not found. Installing..." + curl -LsSf https://astral.sh/uv/install.sh | sh + + if ! command -v uv >/dev/null 2>&1; then + echo "❌ Failed to install uv. Exiting." + exit 1 + fi + + echo "✅ uv installed successfully" +else + UV_VERSION=$(uv --version 2>&1 || echo "unknown") + echo "✅ uv is installed (version: $UV_VERSION)" +fi + echo "🔍 Checking OpenCode installation..." MIN_OPENCODE_VERSION="1.0.137"