File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,20 @@ jobs:
2121 type=semver,pattern={{major}}.{{minor}}
2222 type=semver,pattern={{major}}
2323
24+ - name : Setup buildx
25+ uses : docker/setup-buildx-action@v3
26+
2427 - name : Build and export to Docker local cache
2528 uses : docker/build-push-action@v6
2629 env :
2730 DOCKER_BUILD_RECORD_UPLOAD : false
2831 with :
2932 # Need load and tags so we can test it below
33+ context : .
3034 load : true
3135 tags : test_tag
36+ cache-from : type=gha
37+ cache-to : type=gha,mode=max
3238
3339 - name : Test cli works in cached runtime image
3440 run : docker run --rm test_tag --version
4753 env :
4854 DOCKER_BUILD_RECORD_UPLOAD : false
4955 with :
56+ context : .
5057 push : ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
5158 tags : ${{ steps.meta.outputs.tags }}
5259 labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change @@ -6,8 +6,16 @@ RUN rustup target add x86_64-unknown-linux-musl && \
66 apt-get install -y musl-tools musl-dev && \
77 update-ca-certificates
88
9+ # Build an empty project with only the Cargo files to improve the cache
10+ # performance of the container build. The src directory is expected to change
11+ # most frequently invalidating later caches.
12+ # This downloads and builds the dependencies early allowing built dependencies
13+ # to be cached.
14+ RUN mkdir src && echo 'fn main() {}' > src/main.rs
915COPY ./Cargo.toml ./Cargo.toml
1016COPY ./Cargo.lock ./Cargo.lock
17+ RUN cargo build --release --target x86_64-unknown-linux-musl
18+
1119COPY ./src ./src
1220
1321RUN cargo build --release --target x86_64-unknown-linux-musl
You can’t perform that action at this time.
0 commit comments