Fixes Building in Docker#10982
Conversation
build.sh: fixed errors and added parameters valid_targets, release_targets to get a shortened list of available targets. cmake/docker.sh: avoid initializing cmake on every run of ./build.sh. Dockerfile: fixed syntax and removed unnecessary checks and instructions.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 020c1ca
Previous suggestionsSuggestions up to commit 930d513
|
||||||||||||||||||||
ls returns 0 if at least one file matching the pattern exists, and 2 if none do. Therefore, the block inside if is executed only when matching files are present. In the previous version, it was always executed because ls ./build/*.hex &> /dev/null always returns an empty result due to both stderr and stdout being redirected to /dev/null.
The user inav does not exist in the ubuntu:jammy image, and if you suppress error output during the group or user creation steps, the error will instead appear at the USER inav instruction. This makes it harder to understand why the user is missing.
For this reason, -o pipefail was added.
There is a different logic here. In the previous version, docker build was run only if the image did not exist. However, for example, when the Dockerfile changed, the build was not triggered again. Building the image when the Dockerfile hasn’t changed takes less than a second, so I don’t see a reason to skip it. But I don’t want to see the output every time. Therefore, the first build shows the full output, and subsequent builds only display build errors. |
…he first cmake run.
… and recreate the inav user (for compatibility e.g. ubuntu:noble). pyyaml is installed systemwide via apt-get also for compatibility e.g. ubuntu:noble.
|
Thanks for commenting to note you looked at the things the AI bot pointed at. As you know, the bot can only point at things that might be worth looking at. It doesn't actually know anything. It's often helpful, but often not. |
|
Fixes #10816 ? |
Yes it is. |
User description
build.sh: fixed errors and added parameters valid_targets, release_targets to get a shortened list of available targets.
cmake/docker.sh: avoid initializing cmake on every run of ./build.sh.
Dockerfile: fixed syntax and removed unnecessary checks and instructions.
PR Type
Bug fix, Enhancement
Description
This description is generated by an AI tool. It may have inaccuracies
Fixed Docker build script errors and improved functionality
Added
valid_targetsandrelease_targetsparameters for listing targetsOptimized Docker image rebuilding to avoid unnecessary CMake initialization
Enhanced error handling and output formatting
Diagram Walkthrough
File Walkthrough
build.sh
Enhanced build script with target listingbuild.sh
set -euo pipefailvalid_targetsandrelease_targetscommands for listing availabletargets
docker.sh
Fixed CMake initialization detectioncmake/docker.sh
Makefiletobuild.ninjaDockerfile
Fixed Dockerfile syntax and user setupDockerfile
GDBargument declarationVOLUMEdirective