suse-edge / edge-image-builder

Tool for creating and configuring a set of images to automate the deployment of Edge environments
Apache License 2.0
55 stars 26 forks source link

Investigate using an in-code implementation for copying binary files #22

Open jdob opened 1 year ago

jdob commented 1 year ago

As part of the raw image creation, the base image is first copied to the output location. All modifications are then done to the copy, leaving the base image pristine.

The current implementation (as of https://github.com/suse-edge/edge-image-builder/pull/18) is to shell out to cp. The rationale at the time is that we're already shelling out for other commands (xorriso, guestfish) and since we control the container image, we know cp will exist.

However, it might be cleaner to do this copy in code, using something like https://pkg.go.dev/io#Copy. We need to look into an implementation using this approach and make sure it scales sufficiently for larger binaries (such as the raw image).

It should be noted that this isn't just for raw images. As we add image customization capabilities to EIB, we'll have a need to copy other binaries into the combustion directory (such as RPMs or the RKE2 installer binaries). Ideally, this issue will result in a reusable copyFileToCombustionDir type of method.

atanasdinov commented 1 year ago

https://github.com/suse-edge/edge-image-builder/pull/28 introduced the functionality to copy files from a source to destination directory.

We should investigate whether the performance and behaviour of this are suitable for copying the larger raw image files.