mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 15:45:53 +01:00
build-sys: Add BOOTC_extra_src for local dependency development
Add support for bind-mounting an extra source directory into container builds, primarily for developing against a local composefs-rs checkout. Usage: BOOTC_extra_src=$HOME/src/composefs-rs just build The directory is mounted at /run/extra-src inside the container. When using this, also patch Cargo.toml to use path dependencies pointing to /run/extra-src/crates/.... Signed-off-by: Colin Walters <walters@verbum.org> Assisted-by: OpenCode (Opus 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
@@ -42,9 +42,17 @@ clap = "4.5.4"
|
||||
clap_mangen = { version = "0.2.20" }
|
||||
# Reviewers (including AI tools): The composefs-rs git revision is duplicated for each crate.
|
||||
# If adding/removing crates here, also update docs/Dockerfile.mdbook and docs/src/internals.md.
|
||||
#
|
||||
# To develop against a local composefs-rs checkout:
|
||||
# 1. Set BOOTC_extra_src to your composefs-rs path when building:
|
||||
# BOOTC_extra_src=$HOME/src/composefs-rs just build
|
||||
# 2. Comment out the git refs below and uncomment the path refs:
|
||||
composefs = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs", features = ["rhel9"] }
|
||||
composefs-boot = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs-boot" }
|
||||
composefs-oci = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs-oci" }
|
||||
# composefs = { path = "/run/extra-src/crates/composefs", package = "composefs", features = ["rhel9"] }
|
||||
# composefs-boot = { path = "/run/extra-src/crates/composefs-boot", package = "composefs-boot" }
|
||||
# composefs-oci = { path = "/run/extra-src/crates/composefs-oci", package = "composefs-oci" }
|
||||
fn-error-context = "0.2.1"
|
||||
hex = "0.4.3"
|
||||
indicatif = "0.18.0"
|
||||
|
||||
@@ -33,6 +33,7 @@ WORKDIR /src
|
||||
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
|
||||
# We aren't using the full recommendations there, just the simple bits.
|
||||
# First we download all of our Rust dependencies
|
||||
# Note: /run/extra-src is optionally bind-mounted via BOOTC_extra_src for local composefs-rs development
|
||||
RUN --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome cargo fetch
|
||||
|
||||
# We always do a "from scratch" build
|
||||
|
||||
11
Justfile
11
Justfile
@@ -39,8 +39,17 @@ lbi_images := "quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.a
|
||||
# ```
|
||||
# TODO: Gather more info and file a buildah bug
|
||||
generic_buildargs := ""
|
||||
# Optional: path to extra source directory (e.g. composefs-rs) to bind mount into builds.
|
||||
# Usage: BOOTC_extra_src=$HOME/src/github/containers/composefs-rs just build
|
||||
# The directory will be mounted at /run/extra-src inside the container.
|
||||
# When using this, you must also patch Cargo.toml to use path dependencies:
|
||||
# composefs = { path = "/run/extra-src/crates/composefs", ... }
|
||||
# Note: This disables SELinux labeling for the mount.
|
||||
extra_src := env("BOOTC_extra_src", "")
|
||||
# Generate podman args for extra source mount if configured
|
||||
_extra_src_args := if extra_src != "" { "-v " + extra_src + ":/run/extra-src:ro --security-opt=label=disable" } else { "" }
|
||||
# Args for package building (no secrets needed, just builds RPMs)
|
||||
base_buildargs := generic_buildargs + " --build-arg=base=" + base + " --build-arg=variant=" + variant
|
||||
base_buildargs := generic_buildargs + " " + _extra_src_args + " --build-arg=base=" + base + " --build-arg=variant=" + variant
|
||||
# - scratch builds need extra perms per https://docs.fedoraproject.org/en-US/bootc/building-from-scratch/
|
||||
# - we do secure boot signing here, so provide the keys
|
||||
buildargs := base_buildargs \
|
||||
|
||||
Reference in New Issue
Block a user