Conversation
openenv init generated Dockerfiles copy the built virtualenv twice: once explicitly (COPY --from=builder /app/env/.venv /app/.venv) and once implicitly, since uv sync places .venv inside /app/env and the next layer copies /app/env wholesale (COPY --from=builder /app/env /app/env). This roughly doubles the final image size (~523MB -> two ~524MB layers per dive output in huggingface#1021). Fix: move .venv out of /app/env in the builder stage before the final stage copies happen, then symlink /app/env/.venv -> /app/.venv in the runtime stage so tooling that expects the venv alongside the project (e.g. uv run) keeps working, without shipping a second physical copy. Applied identically to both copies of the template (CLI init template and the Claude Code skill's mirrored asset) since they were already kept byte-for-byte identical apart from the license header. Fixes huggingface#1021
There was a problem hiding this comment.
Stale comment
Reviewed at
c2910b7562daf6738c51a3c3af40ef35e9c9eaf2: moving the builder venv before copying/app/envremoves the duplicate layer, the runtime symlink preservesuv run, and both scaffold copies stay synchronized. No static defect or alignment issue found. Before merge, refresh onto currentmain, approve and pass exact-head CI, and retain functional evidence that a generated scaffold image builds and resolves/app/.venvthrough both PATH and/app/env/.venv; no required CI has run on this branch.Sent by Cursor Automation: Release
|
cursor review |
There was a problem hiding this comment.
APPROVE at a930ded1
Correct fix for the latent double-copy: builder moves .venv to /app/.venv before the wholesale /app/env copy, then recreates /app/env/.venv → /app/.venv so uv run-style tooling still finds it. Both the CLI scaffold template and the generate-openenv-env skill asset are updated consistently.
Wheel cargo: yes — src/openenv/cli/templates/.../Dockerfile ships in the package. Worth a line in release notes when scaffolded images matter.
No Tier 1 issues. LGTM.
Sent by Cursor Automation: Release
There was a problem hiding this comment.
APPROVE at 6524358d (merge-main only)
Rebased onto main after #1178 (1e3f16d6). Feature tip unchanged from prior APPROVE at a930ded1 (Dockerfile template double-venv copy → single /app/.venv + symlink). No new conflicts in the template path.
Still needs exact-head repository CI / Approve-and-run on the fork. 0.6.0 package cargo if merged before Thursday — refresh draft #1211 after green CI.
Sent by Cursor Automation: Release
There was a problem hiding this comment.
APPROVE at 5c1004be (merge-main only)
Rebased onto main after #1219 docs merge (66eb946d). Feature fix unchanged: Dockerfile template still avoids the latent double-copy of .venv.
Package cargo if merged (would require #1211 refresh/TestPyPI). Fork may still need Approve-and-run for exact-head CI.
Sent by Cursor Automation: Release
There was a problem hiding this comment.
Merge-main re-APPROVE at 1e5d951b
Ben merged main into this fork tip. Net feature diff unchanged: both scaffold Dockerfiles still mv /app/env/.venv /app/.venv then symlink back — removes the duplicated physical venv.
Fork PR: repository Tests/Package CI/lint will not run until Approve-and-run. Content review still holds from prior tip.
Package cargo if merged before Thursday (CLI template under src/) — would require refreshing draft #1211.
Sent by Cursor Automation: Release
There was a problem hiding this comment.
Re-APPROVE at 465583f4 (merge-main only)
Ben merged main (26c9465e / #1179) into this fork PR. Stable feature patch-id is unchanged vs prior approved tip 1e5d951b (7fb20446…); both Dockerfile template blobs are identical.
Prior technical approval stands. Still needs maintainer Approve and run for repository CI. Package cargo if merged before Thursday — would require refreshing draft #1211 / TestPyPI again.
Sent by Cursor Automation: Release


Fixes #1021
Problem
openenv initgenerates a Dockerfile whose final stage copies the builtvirtualenv twice: once explicitly, and once again implicitly because
uv syncplaces
.venvinside/app/env, and the next layer copies/app/envwholesale — nesting a second full copy of the venv inside it. This roughly
doubles the image size (confirmed via
divein the issue: two ~523-524MBlayers for what should be one).
Fix
.venvout of/app/envin the builder stage, before the finalstage's copies happen, so the wholesale
COPY --from=builder /app/env /app/envno longer contains a nested venv..venvsymlink inside/app/envin the runtime stage (pointingat the single real copy at
/app/.venv) so tooling that expects the venvalongside the project (e.g.
uv run) still works, with no second physicalcopy on disk.
src/openenv/cli/templates/openenv_env/server/Dockerfileand
.claude/skills/generate-openenv-env/assets/openenv_env_template/server/Dockerfile,since these two files were already kept byte-for-byte identical (aside from
license header) and would otherwise drift.
Testing
Built a fresh env from the fixed template (
openenv init+docker build) andconfirmed via
docker historythat the venv is now copied once, not twice:Note
Low Risk
Build-only Dockerfile template changes; runtime behavior and paths (
PATH,PYTHONPATH, uvicorn CMD) stay the same aside from smaller images.Overview
Fixes duplicate virtualenv layers in the generated OpenEnv server Docker image by restructuring the builder/runtime copy steps.
In the builder stage,
.venvis moved from/app/env/.venvto/app/.venvbefore the final stage copies/app/env, so the wholesale env copy no longer embeds a second full venv (~half the image size per #1021).The runtime stage copies the venv once from
/app/.venv, then adds a symlink at/app/env/.venv→/app/.venvsouv runand similar tools still see a project-local venv without a second on-disk copy.The same change is applied to both kept-in-sync templates:
src/openenv/cli/templates/openenv_env/server/Dockerfileand the Claude skill asset template.Reviewed by Cursor Bugbot for commit 084df12. Bugbot is set up for automated code reviews on this repo. Configure here.