perf(ci): split Dockerfile dep-install from source-copy for faster rebuilds

The dep-install layer (uv sync) now only depends on pyproject.toml,
uv.lock, and a minimal package stub — not the full src/ tree. Source
code changes only rebuild the final COPY layer (seconds, not minutes).

Also switch from type=local cache (lost on ephemeral runners) to
type=gha (persisted in GitHub Actions cache, shared across all runs).

Before: every src/ change → full uv sync rebuild (~8-10 min)
After:  src/-only change → cached dep layer, ~30s source copy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pepijn
2026-04-09 15:15:43 +02:00
parent 415c504567
commit 9a84ae7b61
3 changed files with 17 additions and 10 deletions
+5 -2
View File
@@ -61,9 +61,11 @@ ENV HOME=/home/user_lerobot \
RUN uv venv --python python${PYTHON_VERSION}
# Install only lerobot[libero] — completely isolated from metaworld's dep tree
# ── Dependency layer (cached unless pyproject.toml / uv.lock change) ────────
# Copy only the files uv needs to resolve deps, plus a minimal package stub
# so the editable install can succeed without the full source tree.
COPY --chown=user_lerobot:user_lerobot setup.py pyproject.toml uv.lock README.md MANIFEST.in ./
COPY --chown=user_lerobot:user_lerobot src/ src/
RUN mkdir -p src/lerobot && touch src/lerobot/__init__.py src/lerobot/py.typed
RUN uv sync --locked --extra libero --extra smolvla --no-cache
@@ -84,6 +86,7 @@ snapshot_download(repo_id='lerobot/libero-assets', repo_type='dataset', \
RUN chmod +x /lerobot/.venv/lib/python${PYTHON_VERSION}/site-packages/triton/backends/nvidia/bin/ptxas
# ── Source layer (rebuilds in seconds on code-only changes) ─────────────────
COPY --chown=user_lerobot:user_lerobot . .
CMD ["/bin/bash"]
+5 -2
View File
@@ -61,14 +61,17 @@ ENV HOME=/home/user_lerobot \
RUN uv venv --python python${PYTHON_VERSION}
# Install only lerobot[metaworld] — completely isolated from libero's dep tree
# ── Dependency layer (cached unless pyproject.toml / uv.lock change) ────────
# Copy only the files uv needs to resolve deps, plus a minimal package stub
# so the editable install can succeed without the full source tree.
COPY --chown=user_lerobot:user_lerobot setup.py pyproject.toml uv.lock README.md MANIFEST.in ./
COPY --chown=user_lerobot:user_lerobot src/ src/
RUN mkdir -p src/lerobot && touch src/lerobot/__init__.py src/lerobot/py.typed
RUN uv sync --locked --extra metaworld --extra smolvla --no-cache
RUN chmod +x /lerobot/.venv/lib/python${PYTHON_VERSION}/site-packages/triton/backends/nvidia/bin/ptxas
# ── Source layer (rebuilds in seconds on code-only changes) ─────────────────
COPY --chown=user_lerobot:user_lerobot . .
CMD ["/bin/bash"]