-
Notifications
You must be signed in to change notification settings - Fork 93
fix: improve Windows/WSL compatibility, add multi-stage executor Dockerfile, and add http to https fallback for git clone #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
32e036f
1c77fa6
e06e170
3a4caec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,28 +2,10 @@ | |
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Build stage: compile executor to standalone binary | ||
| FROM ghcr.io/wecode-ai/wegent-base-python3.12:latest AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy pyproject.toml and install dependencies | ||
| COPY executor/pyproject.toml /app/executor/pyproject.toml | ||
|
|
||
| RUN cd /app/executor && uv pip install --system --no-cache -r pyproject.toml | ||
|
|
||
| # Install PyInstaller for building standalone binary (using uv for speed) | ||
| RUN uv pip install --system pyinstaller | ||
|
|
||
| # Copy source code | ||
| COPY executor /app/executor | ||
| COPY shared /app/shared | ||
|
|
||
| # Build standalone binary | ||
| RUN cd /app/executor && bash build.sh | ||
|
|
||
| # Runtime stage: minimal image with only the binary | ||
| FROM ghcr.io/wecode-ai/wegent-base-python3.12:latest | ||
| # ============================================================================ | ||
| # Stage 1: deps — system packages + Python dependencies (shared by all targets) | ||
| # ============================================================================ | ||
| FROM ghcr.io/wecode-ai/wegent-base-python3.12:latest AS deps | ||
|
|
||
| WORKDIR /app | ||
|
|
||
|
|
@@ -42,14 +24,12 @@ RUN dnf install -y \ | |
| && rm -rf /var/cache/dnf/* | ||
|
|
||
| # Install Claude marketplace skills and npm packages for document generation | ||
| # Install to /root so it's available in the base image | ||
| RUN claude plugin marketplace add anthropics/skills \ | ||
| && npm install -g pptxgenjs playwright sharp react react-dom react-icons docx pdf-lib \ | ||
| && npx playwright install chromium \ | ||
| && npm cache clean --force | ||
|
|
||
| # Install Python packages for document generation | ||
| # These are commonly used by document skills | ||
| RUN pip install python-pptx openpyxl python-docx reportlab Pillow pandas \ | ||
| pypdf pdfplumber pytesseract \ | ||
| "markitdown[pptx]" defusedxml weasyprint \ | ||
|
|
@@ -66,13 +46,44 @@ RUN mkdir -p /usr/share/fonts/truetype/noto && \ | |
| -o /usr/share/fonts/truetype/noto/NotoSansSC.ttf) && \ | ||
| fc-cache -f -v | ||
|
|
||
|
|
||
| # Copy only the standalone binary from builder | ||
| COPY --from=builder /app/executor/dist/executor /app/executor | ||
| # Install Python executor dependencies (cached unless pyproject.toml changes) | ||
| COPY executor/pyproject.toml /app/executor/pyproject.toml | ||
| RUN cd /app/executor && uv pip install --system --no-cache -r pyproject.toml | ||
|
|
||
| ENV PORT=10001 | ||
| ENV PYTHONPATH=/app | ||
| ENV NODE_PATH=/usr/lib/node_modules | ||
|
|
||
| # Run the standalone binary | ||
| # ============================================================================ | ||
| # Stage 2: builder — compiles executor Python source to standalone binary | ||
| # ============================================================================ | ||
| FROM deps AS builder | ||
|
|
||
| # Install PyInstaller | ||
| RUN uv pip install --system pyinstaller | ||
|
|
||
| # Copy source code and build binary | ||
| COPY executor /app/executor | ||
| COPY shared /app/shared | ||
| RUN cd /app/executor && bash build.sh | ||
|
Comment on lines
+57
to
+68
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify hidden imports in executor.spec vs build_local.py
echo "=== Checking executor.spec for hidden imports ==="
rg -n "hiddenimports|hidden-import" executor/executor.spec || echo "No hiddenimports found in spec"
echo ""
echo "=== Checking build_local.py for hidden imports ==="
rg -n "hidden-import" executor/scripts/build_local.py | head -30
echo ""
echo "=== Checking runtime_hooks in executor.spec ==="
rg -n "runtime_hooks" executor/executor.spec
echo ""
echo "=== Checking if rthook_version.py exists ==="
fd "rthook_version.py" executor/Repository: wecode-ai/Wegent Length of output: 4284 🏁 Script executed: #!/bin/bash
# Check for specific missing dependencies in executor.spec
echo "=== Checking for grpc, protobuf, watchdog, psutil in executor.spec ==="
rg -n "grpc|protobuf|watchdog|psutil" executor/executor.spec || echo "None found"
echo ""
echo "=== Checking executor pyproject.toml for these dependencies ==="
rg -n "grpc|protobuf|watchdog|psutil|socketio|aiohttp" executor/pyproject.toml
echo ""
echo "=== Verify if rthook_version.py is intended to be used ==="
head -20 executor/hooks/rthook_version.pyRepository: wecode-ai/Wegent Length of output: 1133 Critical: PyInstaller spec is missing hidden imports for installed runtime dependencies. The builder stage uses
Additionally, The Docker image will build successfully but the binary may fail at runtime when these modules are dynamically imported. Note that Update 🤖 Prompt for AI Agents |
||
|
|
||
| # ============================================================================ | ||
| # Stage 3: source — dev target, runs Python source directly (no compilation) | ||
| # docker build --target source -t wegent-executor:local-dev . | ||
| # ============================================================================ | ||
| FROM deps AS source | ||
|
|
||
| COPY executor /app/executor | ||
| COPY shared /app/shared | ||
|
|
||
| CMD ["python", "/app/executor/main.py"] | ||
|
|
||
| # ============================================================================ | ||
| # Stage 4: binary — default target, runs compiled standalone binary | ||
| # docker build -t wegent-executor:latest . | ||
| # ============================================================================ | ||
| FROM deps AS binary | ||
|
|
||
| COPY --from=builder /app/executor/dist/executor /app/executor | ||
|
|
||
| CMD ["/app/executor"] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
|
|
||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the modification to this generated file. This file contains an explicit warning: "Please do NOT modify this file." The added blank line appears to be an unintentional side effect of line ending normalization during the Windows/WSL compatibility fixes. Generated library files should remain pristine to avoid merge conflicts during updates and to maintain alignment with the upstream MSW library version. 🔄 Suggested fixRemove the blank line at the start of the file to restore the original generated content: -
/* tslint:disable */📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| /* tslint:disable */ | ||||||
|
|
||||||
| /** | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: wecode-ai/Wegent
Length of output: 1061
🏁 Script executed:
Repository: wecode-ai/Wegent
Length of output: 2758
🏁 Script executed:
head -55 docker/executor/Dockerfile | tail -20Repository: wecode-ai/Wegent
Length of output: 1019
🏁 Script executed:
rg -n 'from shared|import shared' executor/Repository: wecode-ai/Wegent
Length of output: 13240
🏁 Script executed:
grep -r "shared" executor/pyproject.tomlRepository: wecode-ai/Wegent
Length of output: 175
Executor code imports from shared but pyproject.toml doesn't declare it—this causes runtime failures.
The executor extensively imports from
sharedmodule (logger, models, status, telemetry, utils), butexecutor/pyproject.tomldoes not declare a dependency on shared. At lines 49-51, when executor deps are installed in the deps stage, the shared module is not yet available, causingImportErrorat runtime.Proposed Docker fix
Better fix: Add shared as a dependency in
executor/pyproject.toml(e.g.,"wegent-shared = { path = "../shared" }), matching the pattern used in backend and other services.🤖 Prompt for AI Agents