Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@ RUN --network=none rm tests-unit-container -rf && touch -r src .
FROM buildroot as build
COPY --from=binsrc /src /build
WORKDIR /build
RUN --mount=type=cache,target=/ccache <<EORUN
RUN --mount=type=cache,target=/build/target <<EORUN
set -xeuo pipefail
mkdir -p /var/roothome
env NOCONFIGURE=1 ./autogen.sh
export CC="ccache gcc" CCACHE_DIR=/ccache
env ./configure \
--sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 \
--with-openssl --with-selinux --with-composefs \
. ci/libbuild.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The previous build setup explicitly configured and used ccache to speed up compilations. With the current changes, ccache is still installed by ci/installdeps.sh, but the environment variables CC and CCACHE_DIR are no longer set in this RUN step. This means ccache will likely not be utilized, potentially slowing down builds.

To reinstate ccache functionality, you can set CC and CCACHE_DIR before invoking the build script. The existing cache mount --mount=type=cache,target=/build/target can be leveraged to store ccache data, for example, in /build/target/.ccache.

export CCACHE_DIR="/build/target/.ccache" # Store ccache data within the mounted cache
mkdir -p "${CCACHE_DIR}"
export CC="ccache gcc" # Or your specific compiler, e.g., ccache clang
. ci/libbuild.sh

build --with-openssl --with-selinux --with-composefs \
--with-dracut=yesbutnoconf \
--disable-gtk-doc --with-curl --without-soup
make -j $(nproc)
make install DESTDIR=/out
cd target/c && make install DESTDIR=/out
EORUN

# This image holds both the main binary and the tests
Expand All @@ -39,10 +35,15 @@ RUN rpm -e --nodeps ostree{,-libs}
COPY --from=build /out/ /
COPY --from=src /src/tests-unit-container /tests

# The default final container
FROM $base
# Override userspace
FROM $base as rootfs
# Remove the default binaries to ensure we're getting our overrides
RUN rpm -e --nodeps ostree{,-libs}
COPY --from=build /out/ /

# The default final container, with also a regenerated
# initramfs in case ostree-prepare-root changed.
FROM rootfs
# https://docs.fedoraproject.org/en-US/bootc/initramfs/#_regenerating_the_initrd
# since we have ostree-prepare-root there
RUN set -x; kver=$(cd /usr/lib/modules && echo *); dracut -vf /usr/lib/modules/$kver/initramfs.img $kver
Expand Down
7 changes: 7 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ build:
build-unittest:
podman build --jobs=4 --target build -t localhost/ostree-buildroot .

# Do a build but don't regenerate the initramfs
build-noinitramfs:
podman build --jobs=4 --target rootfs -t localhost/ostree .

# We need a filesystem that supports O_TMPFILE right now (i.e. not overlayfs)
# or ostree hard crashes in the http code =/
unittest_args := "--pids-limit=-1 --tmpfs /var/tmp --tmpfs /tmp"
Expand Down Expand Up @@ -35,3 +39,6 @@ unitcontainer: unitcontainer-build
# need cap-add=all for mounting
podman run --rm --net=none {{unitpriv}} {{unittest_args}} --cap-add=all --env=TEST_CONTAINER=1 localhost/ostree-bintest /tests/run.sh

# Run a build on the host system
build-host:
. ci/libbuild.sh && build
8 changes: 5 additions & 3 deletions ci/libbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ make() {
}

build() {
env NOCONFIGURE=1 ./autogen.sh
if test '!' -f configure; then env NOCONFIGURE=1 ./autogen.sh; fi
mkdir -p target/c
(cd target/c && ../../configure --sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 "$@")
make -C target/c V=1
cd target/c
if test '!' -f Makefile; then ../../configure --sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 "$@"; fi
make V=1
cd -
}

pkg_install() {
Expand Down
Loading