Skip to content

fix(docker): copy dify-agent source into production stage#36757

Merged
GareArc merged 1 commit into
mainfrom
fix/dify-agent-editable-docker
May 28, 2026
Merged

fix(docker): copy dify-agent source into production stage#36757
GareArc merged 1 commit into
mainfrom
fix/dify-agent-editable-docker

Conversation

@GareArc
Copy link
Copy Markdown
Contributor

@GareArc GareArc commented May 28, 2026

Summary

#36735 switched dify-agent to an editable install, which writes a .pth file pointing to /app/dify-agent/src at build time. The production stage copied the venv (including the .pth) but not the source directory itself — making the path dead at runtime and raising ModuleNotFoundError: No module named 'agenton'.

Fix

Add --no-editable to uv sync in the packages stage. This installs all editable deps as regular wheel installs, copying packages directly into site-packages. No source directory is needed at runtime, and future editable local packages will work automatically without additional COPY lines.

Local developer workflow is unaffected — editable behavior is preserved when running uv sync without this flag.

Test plan

  • Build the Docker image locally and verify flask db upgrade completes without ModuleNotFoundError
  • Confirm agenton is importable inside the running container

@GareArc GareArc marked this pull request as ready for review May 28, 2026 05:30
@GareArc GareArc requested a review from QuantumGhost as a code owner May 28, 2026 05:30
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.86%. Comparing base (0e1f19a) to head (1f8f193).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #36757   +/-   ##
=======================================
  Coverage   85.86%   85.86%           
=======================================
  Files        4538     4538           
  Lines      220738   220738           
  Branches    40681    40681           
=======================================
  Hits       189538   189538           
  Misses      27630    27630           
  Partials     3570     3570           
Flag Coverage Δ
api 85.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GareArc GareArc requested review from fatelei and wylswz May 28, 2026 05:34
#36735 switched dify-agent to an editable install, which writes a .pth
file pointing to /app/dify-agent/src. The production stage copied the
venv but not the source, making the path dead at runtime and causing
ModuleNotFoundError: No module named 'agenton'.

--no-editable installs all editable deps as regular wheel installs,
copying packages into site-packages. No source directory needed at
runtime. Local dev is unaffected — editable behavior is preserved when
running uv sync without this flag.
@GareArc GareArc force-pushed the fix/dify-agent-editable-docker branch from 0ab33e2 to 1f8f193 Compare May 28, 2026 05:45
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 28, 2026
@GareArc GareArc enabled auto-merge May 28, 2026 05:50
@GareArc GareArc added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit b94ff65 May 28, 2026
39 checks passed
@GareArc GareArc deleted the fix/dify-agent-editable-docker branch May 28, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants