File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,13 +33,23 @@ jobs:
3333 id : image_name
3434 run : echo "value=ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')/devcontainer" >> $GITHUB_OUTPUT
3535
36+ - name : Warm layer cache (skip on first run when image does not exist yet)
37+ id : cache
38+ run : |
39+ IMAGE="${{ steps.image_name.outputs.value }}"
40+ if docker pull "${IMAGE}:latest" 2>/dev/null; then
41+ echo "from=${IMAGE}" >> $GITHUB_OUTPUT
42+ else
43+ echo "from=" >> $GITHUB_OUTPUT
44+ fi
45+
3646 - name : Build Dev Container and run tests
3747 uses : devcontainers/ci@v0.3
3848 with :
3949 imageName : ${{ steps.image_name.outputs.value }}
40- # Pull the previous image as a layer cache — unchanged layers are reused,
41- # dramatically reducing build time on subsequent runs .
42- cacheFrom : ${{ steps.image_name .outputs.value }}
50+ # Non-empty only after the first successful push; BuildKit skips --cache-from
51+ # when this is blank, avoiding the "not found" hard error introduced in BuildKit 0.12 .
52+ cacheFrom : ${{ steps.cache .outputs.from }}
4353 # This is the same command developers run locally. No translation required.
4454 runCmd : npm test
4555
You can’t perform that action at this time.
0 commit comments