Skip to content

Dockerfile updated with dependencies and fixes#47

Open
rnadyrshin wants to merge 4 commits intodevfrom
nadyrshin/docker-image-fix
Open

Dockerfile updated with dependencies and fixes#47
rnadyrshin wants to merge 4 commits intodevfrom
nadyrshin/docker-image-fix

Conversation

@rnadyrshin
Copy link
Copy Markdown

@rnadyrshin rnadyrshin commented Apr 24, 2026

Changes in dockerfile:

  • Added systemd-container, parted, e2fsprogs, util-linux packages
  • git clone for the build scripts changed to copy from the host folder
  • Added symlink for /artifacts since debos don't support relative path for artifacts folder

- Added systemd-container, parted, e2fsprogs, util-linux packages
- git clone for the build scripts changed to copy from the host folder
- Added symlinc for /artifacts since debos don't support relative path for artifacts folder
@rnadyrshin rnadyrshin requested a review from a team April 24, 2026 12:52
- Create EXT4 temporary EXT4 image in Docker container for sparse OS image operations (truncate, fallocate)
- Increase image size from 4 GB to 5 GB
Comment thread Dockerfile
Comment on lines +58 to +63
RUN apt-get install -y systemd-container

RUN apt-get install -y parted

RUN apt-get install -y e2fsprogs util-linux

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please add these packages to the existing list instead? Each RUN command creates a separate layer in Docker, and each apt-get call recalculates dependencies, making the build slower

Comment thread build-images.sh Outdated
BUILD_ID="$BUILD_ID" \
./partitions-script.sh
sudo losetup -d "$LOOPDEV"
FM_BACKEND="qemu"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will be unbelievably slow. It's like 10x slower than native build. That was the reason I went for the loopdev-based solution.

I don't mind adding a Qemu option as a last resort, but not instead of the loopdev-one please.

Ideally we should just patch bmaptool to add the possibility to extract sparse subranges (preserving holes from the original file) - then we won't need either, the build will be much faster and won't require root.

Comment thread build-rootfs-img.sh Outdated
mkfs.ext4 -F "$STAGE_IMG"

mkdir -p "$STAGE_MNT"
LOOP=$(losetup -f --show "$STAGE_IMG")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This requires root, so it will break builds for all non-root usage (which is our primary use case with Buildbot). It should also be bypassed completely if the build is already running in an ext4 or XFS filesystem, both of which support fallocate --collapse-range

Comment thread build-rootfs-img.sh Outdated

mkdir -p "$STAGE_MNT"
LOOP=$(losetup -f --show "$STAGE_IMG")
mount "$LOOP" "$STAGE_MNT"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also requires root. You can also directly call mount -o loop "$STAGE_IMG" "$STAGE_MNT" and avoid manual loop device creation

Comment thread Dockerfile
RUN git clone --depth=1 https://github.com/flipperdevices/rk3576-linux-build .
COPY . /rk3576-linux-build

RUN ln -s /artifacts /rk3576-linux-build/artifacts
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please explain in more detail why this one is needed? I can't see why are we creating a subdirectory and then creating workarounds to help with the fact that all the stuff is suddenly inside a subdirectory :)

Comment thread build-rootfs-img.sh Outdated

cd "$IMG_OUT"
umount "$LOOP"
losetup -d "$LOOP"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This step won't be needed if you use mount -o loop instead of manually creating a loop device

Comment thread build-images.sh
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please squash related commits - otherwise it's hard to review. The fix itself makes sense, as long as you address the feedback on the previous commit (especially making it work again for non-root users)

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.

2 participants