Skip to content

Commit 005f695

Browse files
committed
chore(container): reduce context churn and document cache
1 parent 7074e8e commit 005f695

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

.dockerignore

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1+
/.coverage/
12
/.git
23
/.git-blame-ignore
34
/.github
5+
/.githooks/
46
/.gitignore
7+
/.markdownlint.json
8+
/.taplo.toml
59
/.vscode
10+
/.yamllint-ci.yml
11+
/AGENTS.md
612
/bin/
7-
/tracker.*
8-
/cSpell.json
13+
/codecov.yaml
14+
/compose.*.yaml
15+
/cspell.json
916
/data.db
17+
/docs/
1018
/docker/bin/
19+
/etc/
20+
/integration_tests_sqlite3.db
1121
/NOTICE
22+
/project-words.txt
1223
/README.md
1324
/rustfmt.toml
1425
/storage/
1526
/target/
16-
/etc/
27+
/tracker.*

Containerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ WORKDIR /tmp
1515
RUN apt-get update; apt-get install -y curl sqlite3; apt-get autoclean
1616
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
1717
RUN cargo binstall --no-confirm cargo-nextest
18+
# Database initialization: Tests at runtime require a pre-initialized SQLite3 database
19+
# to test against a valid (not corrupted) schema. The VACUUM command optimizes the
20+
# database file layout. This image layer is inherited by test_debug and test stages.
1821

1922
COPY ./share/ /app/share/torrust
2023
RUN mkdir -p /app/share/torrust/default/database/; \
@@ -38,13 +41,19 @@ FROM chef AS dependencies_debug
3841
WORKDIR /build/src
3942
COPY --from=recipe /build/recipe.json /build/recipe.json
4043
RUN cargo chef cook --tests --benches --examples --workspace --all-targets --all-features --recipe-path /build/recipe.json
44+
# Pre-link warm-up: Create and discard a nextest archive to warm up the linker
45+
# before final compilation. This improves incremental build cache efficiency
46+
# by pre-faulting the linker phases, avoiding redundant linking work in later stages.
4147
RUN cargo nextest archive --tests --benches --examples --workspace --all-targets --all-features --archive-file /build/temp.tar.zst ; rm -f /build/temp.tar.zst
4248

4349
## Cook (release)
4450
FROM chef AS dependencies
4551
WORKDIR /build/src
4652
COPY --from=recipe /build/recipe.json /build/recipe.json
4753
RUN cargo chef cook --tests --benches --examples --workspace --all-targets --all-features --recipe-path /build/recipe.json --release
54+
# Pre-link warm-up: Create and discard a nextest archive to warm up the linker
55+
# before final compilation. This improves incremental build cache efficiency
56+
# by pre-faulting the linker phases, avoiding redundant linking work in later stages.
4857
RUN cargo nextest archive --tests --benches --examples --workspace --all-targets --all-features --archive-file /build/temp.tar.zst --release ; rm -f /build/temp.tar.zst
4958

5059

0 commit comments

Comments
 (0)