Reduce Docker image build context#637
Conversation
|
Added an api-rs-specific compile optimization in 076b9b1: the Dockerfile now uses cargo-chef to split dependency compilation from the final application compile. This should make ordinary source-only api-rs changes reuse the dependency layer instead of spending the full compile step rebuilding deps. Caveat: I could not run a local Docker build in this sandbox because there is no Docker daemon/socket. CI should validate the image build. |
|
Looked at paradigmxyz/reth's Docker build setup and ported the part we can change without workflow-token scope. What reth does:
What I added here in b76a9ba:
The remaining reth-style optimization is wiring DEPOT_TOKEN into the image build as a secret for remote sccache. That requires editing .github/workflows/publish-images.yml, which this OAuth token still cannot push because it lacks workflow scope. |
|
Pushed Dockerfile support for Depot-backed sccache in 084a30c. It now mounts The remaining workflow change is blocked by my token lacking permissions:
contents: read
packages: write
+ id-token: write
- - name: Set up Docker Buildx
+ - name: Set up Depot CLI
+ if: ${{ !github.event.pull_request.head.repo.fork }}
+ uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
+
+ - name: Set up Docker Buildx
+ if: ${{ github.event.pull_request.head.repo.fork }}
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- - name: Build and push ${{ matrix.image }} (${{ matrix.platform }})
+ - name: Build and push ${{ matrix.image }} (${{ matrix.platform }}) with Depot
id: build
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
+ if: ${{ !github.event.pull_request.head.repo.fork }}
+ uses: depot/build-push-action@98e78adca7817480b8185f474a400b451d74e287 # v1
+ env:
+ DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
with:
+ project: ${{ vars.DEPOT_PROJECT_ID }}
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
target: ${{ matrix.target }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
+ secrets: |
+ DEPOT_TOKEN=${{ secrets.DEPOT_TOKEN }}Keep the existing Docker fallback build step for fork PRs, because forks will not have Depot secrets. |
|
Update based on “we have Paradigm OSS”: use the existing Paradigm OSS Depot project for Recommended workflow wiring:
|
Summary
Validation
Follow-up