Skip to content

Commit ed4b97e

Browse files
committed
Warm Docker dependencies with Cargo config
1 parent b679221 commit ed4b97e

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
ref_scope="pr-${{ github.event.pull_request.number }}"
264264
fi
265265
266-
recipe_hash="${{ hashFiles('Dockerfile', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**') }}"
266+
recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**') }}"
267267
{
268268
echo "current=sqlpage-${ref_scope}${{ steps.suffix.outputs.suffix }}-${recipe_hash}"
269269
echo "main=sqlpage-main${{ steps.suffix.outputs.suffix }}-${recipe_hash}"
@@ -336,7 +336,7 @@ jobs:
336336
ref_scope="pr-${{ github.event.pull_request.number }}"
337337
fi
338338
339-
recipe_hash="${{ hashFiles('Dockerfile', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**') }}"
339+
recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**') }}"
340340
{
341341
echo "artifact=sqlpage-${ref_scope}-linux-amd64-hurl-${recipe_hash}"
342342
echo "current=sqlpage-${ref_scope}-linux-amd64-${recipe_hash}"

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ ARG CARGO_PROFILE=superoptimized
77
ENV CARGO_PROFILE=$CARGO_PROFILE
88

99
COPY scripts/ /usr/local/bin/
10-
RUN cargo init --lib . && \
11-
printf 'pub fn dependency_warmup() {}\n' > src/lib.rs && \
12-
printf 'fn main() { sqlpage::dependency_warmup(); }\n' > src/main.rs
10+
RUN cargo init .
1311

1412
RUN /usr/local/bin/setup-cross-compilation.sh "$TARGETARCH" "$BUILDARCH"
1513

14+
COPY .cargo/ .cargo/
1615
COPY Cargo.toml Cargo.lock build.rs ./
1716
COPY sqlpage/ sqlpage/
1817
RUN /usr/local/bin/build-dependencies.sh

0 commit comments

Comments
 (0)