Skip to content

Commit 45eba36

Browse files
Added uv cache mount & latest fallback
Co-authored-by: PierreQuinton <PierreQuinton@users.noreply.github.com>
1 parent 69b15d4 commit 45eba36

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ WORKDIR /tmp/torchjd-install
2121

2222
COPY pyproject.toml README.md ./
2323
RUN mkdir -p src/torchjd && touch src/torchjd/__init__.py
24-
RUN uv venv /opt/venv \
24+
RUN --mount=type=cache,target=/root/.cache/uv \
25+
uv venv /opt/venv \
2526
&& uv pip install --python-version=3.14 -e '.[full]' --group check --group doc --group test --group plot
2627

2728
COPY src/ src/

.github/workflows/build-devcontainer.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ jobs:
2828
run: |
2929
repo_lower=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')
3030
echo "name=ghcr.io/$repo_lower/devcontainer:latest" >> $GITHUB_OUTPUT
31+
echo "repo_lower=$repo_lower" >> $GITHUB_OUTPUT
3132
if [ "${{ github.event_name }}" = "pull_request" ]; then
32-
echo "cache-from=" >> $GITHUB_OUTPUT
3333
echo "cache-to=" >> $GITHUB_OUTPUT
3434
else
35-
echo "cache-from=type=registry,ref=ghcr.io/$repo_lower/devcontainer:cache" >> $GITHUB_OUTPUT
3635
echo "cache-to=type=registry,ref=ghcr.io/$repo_lower/devcontainer:cache,mode=max" >> $GITHUB_OUTPUT
3736
fi
3837
@@ -54,5 +53,7 @@ jobs:
5453
file: .devcontainer/Dockerfile
5554
push: ${{ github.event_name != 'pull_request' }}
5655
tags: ${{ steps.image.outputs.name }}
57-
cache-from: ${{ steps.image.outputs.cache-from }}
56+
cache-from: |
57+
type=registry,ref=ghcr.io/${{ steps.image.outputs.repo_lower }}/devcontainer:cache
58+
type=registry,ref=ghcr.io/${{ steps.image.outputs.repo_lower }}/devcontainer:latest
5859
cache-to: ${{ steps.image.outputs.cache-to }}

.github/workflows/checks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ jobs:
102102
file: .devcontainer/Dockerfile
103103
push: true
104104
tags: ${{ steps.image.outputs.name }}
105-
cache-from: type=registry,ref=${{ steps.image.outputs.cache-ref }}
105+
cache-from: |
106+
type=registry,ref=${{ steps.image.outputs.cache-ref }}
107+
type=registry,ref=ghcr.io/${{ github.repository_owner }}/devcontainer:latest
106108
cache-to: type=registry,ref=${{ steps.image.outputs.cache-ref }},mode=max
107109

108110
build-doc:

0 commit comments

Comments
 (0)