Skip to content

Conversation

@rjaegers
Copy link
Member

@rjaegers rjaegers commented Jun 26, 2025

🚀 Hey, I have created a Pull Request

Description of changes

This PR prevents the creation of Python cache artifacts during build by:

  • Disabling bytecode compilation during pip install
  • Moving Python cache directory to /cache/.python instead of the default in source tree (/usr/lib/..)

This prevents the creation of __pycache__ folders with *.pyc files which helps with:

  • Reducing container size
  • Making the build reproducible

There will be a minor penalty on start-up time of Python tools like Conan and GCovr, but this will be offset by the smaller image size. After the first run the files will be created anyway in /cache/.python. And will be persisted if /cache is bind mounted.

✔️ Checklist

  • I have followed the contribution guidelines for this repository
  • I have added tests for new behavior, and have not broken any existing tests
  • I have added or updated relevant documentation
  • I have verified that all added components are accounted for in the SBOM

This prevents creation of *.pyc files which helps with:
- Reducing container size
- Making the build reproducible
Copilot AI review requested due to automatic review settings June 26, 2025 17:22
@rjaegers rjaegers requested a review from a team as a code owner June 26, 2025 17:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR disables Python bytecode compilation during pip install to reduce container size and improve build reproducibility.

  • Adds --no-compile flag to the pip install command.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2025

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 18 0 0 0.5s
✅ DOCKERFILE hadolint 2 0 0 0.81s
✅ GHERKIN gherkin-lint 2 0 0 0.97s
✅ JSON npm-package-json-lint yes no no 0.35s
✅ JSON prettier 16 1 0 0 0.44s
✅ JSON v8r 16 0 0 8.77s
✅ MARKDOWN markdownlint 9 0 0 0 0.84s
✅ MARKDOWN markdown-table-formatter 9 0 0 0 0.25s
✅ REPOSITORY checkov yes no no 16.33s
✅ REPOSITORY gitleaks yes no no 0.4s
✅ REPOSITORY git_diff yes no no 0.01s
⚠️ REPOSITORY grype yes no 2 23.4s
✅ REPOSITORY secretlint yes no no 0.96s
✅ REPOSITORY syft yes no no 2.04s
✅ REPOSITORY trivy yes no no 5.29s
✅ REPOSITORY trivy-sbom yes no no 0.22s
✅ REPOSITORY trufflehog yes no no 3.2s
✅ SPELL lychee 63 0 0 1.82s
✅ YAML prettier 24 0 0 0 0.93s
✅ YAML v8r 24 0 0 6.62s
✅ YAML yamllint 24 0 0 0.95s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2025

📦 Container Size Analysis

Comparing ghcr.io/philips-software/amp-devcontainer-rust:edge to ghcr.io/philips-software/amp-devcontainer-rust:pr-842

📈 Size Comparison Table

OS/Platform Previous Size Current Size Change Trend
linux/amd64 489.22M 489.22M 0.00 (+0.00%) 🔄
linux/arm64 441.18M 441.18M 0.00 (+0.00%) 🔄

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2025

📦 Container Size Analysis

Comparing ghcr.io/philips-software/amp-devcontainer-cpp:edge to ghcr.io/philips-software/amp-devcontainer-cpp:pr-842

📈 Size Comparison Table

OS/Platform Previous Size Current Size Change Trend
linux/amd64 673.46M 662.41M -11.06M (-1.64%) 🔽
linux/arm64 656.60M 645.11M -11.50M (-1.75%) 🔽

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2025

Test Results

 4 files  ±0   4 suites  ±0   2m 26s ⏱️ +3s
30 tests ±0  30 ✅ ±0  0 💤 ±0  0 ❌ ±0 
64 runs  ±0  64 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit dfe0faf. ± Comparison against base commit 2366d49.

♻️ This comment has been updated with latest results.

@magi-arun magi-arun requested a review from EkelmansPh June 27, 2025 07:14
@rjaegers rjaegers changed the title chore: disable bytecode compilation during pip install chore: remove python cache artifacts in the final image Jun 27, 2025
@rjaegers rjaegers changed the title chore: remove python cache artifacts in the final image chore: remove python cache artifacts in the images Jun 27, 2025
@sonarqubecloud
Copy link

@rjaegers rjaegers enabled auto-merge (squash) June 27, 2025 12:38
@rjaegers rjaegers merged commit e21c90e into main Jun 27, 2025
34 checks passed
@rjaegers rjaegers deleted the feature/disable-pip-compile branch June 27, 2025 12:53
@github-actions
Copy link
Contributor

Pull Request Report (#842)

Static measures

Description Value
Number of added lines 27
Number of deleted lines 25
Number of changed files 3
Number of commits 17
Number of reviews 3
Number of comments (w/o review comments) 5
Number of reviews that contains a comment to resolve 2
Number of reviews that requested a change from the author 0
Number of reviews that approved the Pull Request 1
Get the total number of participants of a Pull Request 6

Time related measures

Description Value
PR lead time (from creation to close of PR) 19.5 Hours
Time that was spend on the branch before the PR was created 5 Min
Time that was spend on the branch before the PR was merged 19.6 Hours
Time to merge after last review 5.6 Hours

Status check related measures

Description Value
Total runtime for last status check run (Workflow for PR) 28.6 Min
Total time spend in last status check run on PR 16.3 Min

@github-actions
Copy link
Contributor

🎉 Hooray! The changes in this pull request went live with the release of v6.2.0 🎉

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.

3 participants