Skip to content

chore(container): audit and reorganize .dockerignore (#1851) - #1858

Merged
josecelano merged 2 commits into
torrust:developfrom
josecelano:1851-workflow-performance-dockerignore-audit
Jun 1, 2026
Merged

chore(container): audit and reorganize .dockerignore (#1851)#1858
josecelano merged 2 commits into
torrust:developfrom
josecelano:1851-workflow-performance-dockerignore-audit

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Reorganizes .dockerignore into clearly labeled sections and adds several missing exclusions, reducing the Docker build context and narrowing the cache-invalidation surface.

What Changed

.dockerignore reorganized into labeled sections:

  • ## Runtime config templates — share/
  • ## Documentation — docs/, README.md, SECURITY.md, LICENSE, NOTICE
  • ## Developer tooling — .github/, contrib/dev-tools/ (with !contrib/dev-tools/su-exec/ negation to retain the su-exec source needed by the container build)
  • ## CI / repo metadata — .git/, target/

New exclusions added:

  • SECURITY.md, LICENSE — legal/documentation files not needed in the image
  • packages/AGENTS.md, src/AGENTS.md — AI agent instruction files
  • contrib/dev-tools/ (entire directory, except su-exec/) — benchmarks, scripts, and analysis tooling that previously slipped through

Measured Impact

Metric Before After Delta
Docker build context 4.75 MB 4.64 MB −110 kB (−2.3%)

Cache invalidation surface reduced: changes inside contrib/dev-tools/ (workflow benchmarks, analysis scripts, etc.) no longer trigger a source-stage cache miss.

Files Changed

Validation

  • docker build executed before and after; build context size measured with --progress=plain output
  • docker build --no-cache confirmed su-exec/ source is still present in the image (required for su-exec binary compilation)
  • All pre-push checks passed (fmt, clippy, tests)

Closes #1851

Update EPIC torrust#1840 progress:
- Check off 'Subissues created and linked in this spec'
- Add progress log: PR torrust#1855 merged; all sub-issue specs (rows 2-12)
  are now in develop; renamed torrust#1726 folder to match EPIC sub-issue
  naming convention
…1851)

- Add header block documenting all intentionally INCLUDED paths
  (.cargo/, Cargo.toml/lock, Containerfile, console/, packages/,
  share/, src/, tests/, contrib/bencode/, contrib/dev-tools/su-exec/)
- Reorganize entries into labeled sections: git metadata, CI/dev
  tooling, documentation, dev tooling, build artifacts, test data
- Add missing safe exclusions: SECURITY.md, LICENSE, packages/AGENTS.md,
  src/AGENTS.md, /.vscode/
- Exclude contrib/dev-tools/ in full; restore su-exec/ via negation rule
  (! negation) since gcc stage compiles it
- Build context: 4.75 MB -> 4.64 MB (-110 kB, -2.3%); contrib/dev-tools/
  changes no longer trigger source-stage cache misses

Update ISSUE.md: mark T1-T4 DONE, M1/M3/AC1-3/AC5-6 DONE, record
baseline and post-change context measurements.
Copilot AI review requested due to automatic review settings June 1, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reorganizes .dockerignore into clearly labeled sections and adds new exclusions (SECURITY.md, LICENSE, packages/AGENTS.md, src/AGENTS.md, and contrib/dev-tools/ except su-exec/), reducing build context by ~110 kB and narrowing cache-invalidation surface. Spec and EPIC docs are updated to reflect implementation status.

Changes:

  • Reorganize .dockerignore into labeled sections with a header documenting intentionally-included paths.
  • Exclude additional dev/legal/docs files; keep contrib/dev-tools/su-exec/ via re-include rule.
  • Update issue spec and EPIC progress logs to mark relevant tasks/ACs as DONE.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.dockerignore Reorganized into sections; added new exclusions; documented intentional inclusions.
docs/issues/open/1851-1840-workflow-performance-dockerignore-audit/ISSUE.md Marks T1–T5 and AC1–AC3/AC5/AC6 as DONE; records measured context size delta.
docs/issues/open/1840-improve-pr-workflow-performance-epic/EPIC.md Marks "subissues created and linked" as done; appends progress log entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@josecelano josecelano self-assigned this Jun 1, 2026
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.80%. Comparing base (f2a4ba4) to head (1043b49).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1858   +/-   ##
========================================
  Coverage    77.80%   77.80%           
========================================
  Files          380      380           
  Lines        28648    28648           
  Branches     28648    28648           
========================================
  Hits         22290    22290           
  Misses        6052     6052           
  Partials       306      306           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano

Copy link
Copy Markdown
Member Author

ACK 1043b49

@josecelano
josecelano merged commit a5ed18a into torrust:develop Jun 1, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit .dockerignore to minimize Docker build context

2 participants