edge-image-builder

module
v1.0.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: Apache-2.0

README

Edge Image Builder (EIB)

Building

EIB is intended to run inside a container. Some form of container build tool and runtime are needed, such as Podman.

Prerequisites

Before building the EIB image, make sure that you have the development headers and libraries for gpgme, device-mapper and libbtrfs installed on your system:

SUSE Linux:

sudo zypper install -y gpgme-devel device-mapper-devel libbtrfs-devel

Ubuntu:

sudo apt-get install -y libgpgme-dev libdevmapper-dev libbtrfs-dev

Fedora:

sudo dnf -y install gpgme-devel device-mapper-devel btrfs-progs-devel

Build the container (from the root of this project):

podman build -t eib:dev .

Running

NOTE: These docs are incomplete and will be fleshed out as the project matures. At some point when it's more mature, an example configuration directory will be added to this repository.

Image Definition

For details on how to create the artifacts needed to build an image, see the Building Images guide.

Running EIB

The image configuration directory must be attached to the container at runtime. This serves as both the mechanism to introduce image definition files and provide a way to get the built image out of the container and onto the host machine.

Validating an image definition

The following example command attaches the image configuration directory and validates a definition:

podman run --rm -it -v $IMAGE_DIR:/eib \
eib:dev \
validate --definition-file $DEFINITION_FILE.yaml
  • -v - Used to mount a local directory (in this example, the value of $IMAGE_DIR) into the EIB container at /eib.
  • --definition-file - Specifies which image definition file to build. The path to this file will be relative to the image configuration directory. If the definition file is in the root of the configuration directory, simply specify the name of the configuration file.
  • --config-dir - (Optional) Specifies the image configuration directory. This path is relative to the running container, so its value must match the mounted volume. It defaults to /eib which matches the mounted volume $IMAGE_DIR:/eib in the example above.
Building an image

The following example command attaches the image configuration directory and builds an image:

podman run --rm -it -v $IMAGE_DIR:/eib \
eib:dev \
build --definition-file $DEFINITION_FILE.yaml

NOTE: Image builds which involve package resolution must include the --privileged flag. Package resolution will be automatically performed when requesting package installation or configuring components which require it (e.g. Elemental, Kubernetes SELinux, etc.).

  • -v - Used to mount a local directory (in this example, the value of $IMAGE_DIR) into the EIB container at /eib.
  • --definition-file - Specifies which image definition file to build. The path to this file will be relative to the image configuration directory. If the definition file is in the root of the configuration directory, simply specify the name of the configuration file.
  • --config-dir - (Optional) Specifies the image configuration directory. This path is relative to the running container, so its value must match the mounted volume. It defaults to /eib which matches the mounted volume $IMAGE_DIR:/eib in the example above.
  • --build-dir - (Optional) If unspecified, EIB will create a _build directory under the image configuration directory for assembling/generating the components used in the build which will persist after EIB finishes. This may also be specified to another location within a mounted volume. The directory will contain subdirectories storing the respective artifacts of the different builds as well as cached copies of certain downloaded files.

Testing Images

For details on how to test the built images, see the Testing Guide.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL