git: 0fbe9f8ef94d - main - share/examples/oci: Run 'pkg update' with IGNORE_OSVERSION set

From: Doug Rabson <dfr_at_FreeBSD.org>
Date: Tue, 22 Jul 2025 10:47:49 UTC
The branch main has been updated by dfr:

URL: https://cgit.FreeBSD.org/src/commit/?id=0fbe9f8ef94d15439e89a3ab951d1dda254d54e3

commit 0fbe9f8ef94d15439e89a3ab951d1dda254d54e3
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2025-05-28 15:00:00 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2025-07-22 10:46:01 +0000

    share/examples/oci: Run 'pkg update' with IGNORE_OSVERSION set
    
    This allows the image build to work even if the host's OSVERSION doesn't
    match the pkgbase OSVERSION which happens if the host's patch level or
    release version isn't the same as pkgbase.
    
    Also fix the image name so that Podman/Buildah will fetch it
    automatically, removing the need for users to pull an image and retag it
    before using this example.
    
    Reviewed by:            dch
    MFC after:              3 days
    Differential Revision:  https://reviews.freebsd.org/D50596
---
 share/examples/oci/Containerfile.pkg | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/share/examples/oci/Containerfile.pkg b/share/examples/oci/Containerfile.pkg
index 074c470affc9..f6699c79af71 100644
--- a/share/examples/oci/Containerfile.pkg
+++ b/share/examples/oci/Containerfile.pkg
@@ -6,7 +6,7 @@
 ARG version=14.snap
 
 # Select freebsd-runtime as our starting point.
-FROM localhost/freebsd-runtime:${version}
+FROM ghcr.io/freebsd/freebsd-runtime:${version}
 
 # A list of package(s) to install
 ARG packages
@@ -15,7 +15,10 @@ ARG packages
 # use for downloading pkg since the freebsd-runtime image has both FreeBSD and
 # FreeBSD-base pkg repo configs installed and FreeBSD-base does not contain the
 # pkg package.
-RUN env ASSUME_ALWAYS_YES=yes pkg bootstrap -r FreeBSD && pkg update
+#
+# Set IGNORE_OSVERSION to allow building e.g. FreeBSD-14 images on
+# FreeBSD-15 hosts.
+RUN pkg bootstrap -y -r FreeBSD && pkg -o IGNORE_OSVERSION=yes update -f
 
 # Install some package(s).
 RUN pkg install -y ${packages}