Skip to content

Commit cd13ece

Browse files
committed
First version
1 parent 4bf99ab commit cd13ece

File tree

6 files changed

+175
-230
lines changed

6 files changed

+175
-230
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ jobs:
3535
packages: write
3636
id-token: write
3737

38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
variant:
42+
- base_image: "ghcr.io/ublue-os/bluefin-dx:stable-daily"
43+
tag_suffix: ""
44+
- base_image: "ghcr.io/ublue-os/bluefin-dx-nvidia:stable-daily"
45+
tag_suffix: "-nvidia"
46+
3847
steps:
3948
- name: Prepare environment
4049
run: |
@@ -80,12 +89,13 @@ jobs:
8089
with:
8190
# This generates all the tags for your image, you can add custom tags here too!
8291
# Default tags are "$DEFAULT_TAG" and "$DEFAULT_TAG.$date".
92+
# Matrix tag_suffix is appended to differentiate variants (e.g., latest vs latest-nvidia)
8393
tags: |
84-
type=raw,value=${{ env.DEFAULT_TAG }}
85-
type=raw,value=${{ env.DEFAULT_TAG }}.{{date 'YYYYMMDD'}}
86-
type=raw,value={{date 'YYYYMMDD'}}
87-
type=sha,enable=${{ github.event_name == 'pull_request' }}
88-
type=ref,event=pr
94+
type=raw,value=${{ env.DEFAULT_TAG }}${{ matrix.variant.tag_suffix }}
95+
type=raw,value=${{ env.DEFAULT_TAG }}${{ matrix.variant.tag_suffix }}.{{date 'YYYYMMDD'}}
96+
type=raw,value={{date 'YYYYMMDD'}}${{ matrix.variant.tag_suffix }}
97+
type=sha,enable=${{ github.event_name == 'pull_request' }},suffix=${{ matrix.variant.tag_suffix }}
98+
type=ref,event=pr,suffix=${{ matrix.variant.tag_suffix }}
8999
labels: |
90100
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}/refs/heads/main/README.md
91101
org.opencontainers.image.created=${{ steps.date.outputs.date }}
@@ -116,6 +126,8 @@ jobs:
116126
image: ${{ env.IMAGE_NAME }}
117127
tags: ${{ steps.metadata.outputs.tags }}
118128
labels: ${{ steps.metadata.outputs.labels }}
129+
build-args: |
130+
BASE_IMAGE=${{ matrix.variant.base_image }}
119131
oci: false
120132

121133
# Rechunk is a script that we use on Universal Blue to make sure there isnt a single huge layer when your image gets published.

Containerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ FROM scratch AS ctx
33
COPY build_files /
44

55
# Base Image
6-
FROM ghcr.io/ublue-os/bazzite:stable
6+
# This build argument allows building different variants (regular vs NVIDIA)
7+
ARG BASE_IMAGE=ghcr.io/ublue-os/bluefin-dx:stable-daily
8+
FROM ${BASE_IMAGE}
79

810
## Other possible base images include:
911
# FROM ghcr.io/ublue-os/bazzite:latest
10-
# FROM ghcr.io/ublue-os/bluefin-nvidia:stable
11-
#
12+
# FROM ghcr.io/ublue-os/bluefin-dx-nvidia:stable-daily
13+
#
1214
# ... and so on, here are more base images
1315
# Universal Blue Images: https://github.com/orgs/ublue-os/packages
1416
# Fedora base image: quay.io/fedora/fedora-bootc:41
@@ -19,11 +21,12 @@ FROM ghcr.io/ublue-os/bazzite:stable
1921
## the following RUN directive does all the things required to run "build.sh" as recommended.
2022

2123
RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
22-
--mount=type=cache,dst=/var/cache \
23-
--mount=type=cache,dst=/var/log \
24-
--mount=type=tmpfs,dst=/tmp \
25-
/ctx/build.sh
26-
24+
--mount=type=cache,dst=/var/cache \
25+
--mount=type=cache,dst=/var/log \
26+
--mount=type=tmpfs,dst=/tmp \
27+
/ctx/build.sh && \
28+
ostree container commit
29+
2730
### LINTING
2831
## Verify final image and contents are correct.
2932
RUN bootc container lint

Justfile

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export image_name := env("IMAGE_NAME", "image-template") # output image name, usually same as repo name, change as needed
22
export default_tag := env("DEFAULT_TAG", "latest")
33
export bib_image := env("BIB_IMAGE", "quay.io/centos-bootc/bootc-image-builder:latest")
4+
export base_image := env("BASE_IMAGE", "ghcr.io/ublue-os/bluefin-dx:stable-daily")
5+
export base_image_nvidia := env("BASE_IMAGE_NVIDIA", "ghcr.io/ublue-os/bluefin-dx-nvidia:stable-daily")
46

57
alias build-vm := build-qcow2
68
alias rebuild-vm := rebuild-qcow2
@@ -73,33 +75,55 @@ sudoif command *args:
7375
# Arguments:
7476
# $target_image - The tag you want to apply to the image (default: $image_name).
7577
# $tag - The tag for the image (default: $default_tag).
78+
# $base_img - The base image to use (default: $base_image).
7679
#
7780
# The script constructs the version string using the tag and the current date.
7881
# If the git working directory is clean, it also includes the short SHA of the current HEAD.
7982
#
80-
# just build $target_image $tag
83+
# just build $target_image $tag $base_img
8184
#
8285
# Example usage:
83-
# just build aurora lts
86+
# just build binaryos latest
87+
# just build binaryos nvidia ghcr.io/ublue-os/bluefin-dx-nvidia:stable-daily
8488
#
85-
# This will build an image 'aurora:lts' with DX and GDX enabled.
89+
# This will build an image with the specified base image.
8690
#
8791

8892
# Build the image using the specified parameters
89-
build $target_image=image_name $tag=default_tag:
93+
build $target_image=image_name $tag=default_tag $base_img=base_image:
9094
#!/usr/bin/env bash
9195

9296
BUILD_ARGS=()
97+
BUILD_ARGS+=("--build-arg" "BASE_IMAGE={{ base_img }}")
98+
9399
if [[ -z "$(git status -s)" ]]; then
94100
BUILD_ARGS+=("--build-arg" "SHA_HEAD_SHORT=$(git rev-parse --short HEAD)")
95101
fi
96102

97103
podman build \
98104
"${BUILD_ARGS[@]}" \
99105
--pull=newer \
100-
--tag "${target_image}:${tag}" \
106+
--tag "{{ target_image }}:{{ tag }}" \
101107
.
102108

109+
# Build the regular (non-NVIDIA) variant
110+
[group('Build Variants')]
111+
build-regular $target_image=image_name:
112+
@just build "{{ target_image }}" "{{ default_tag }}" "{{ base_image }}"
113+
114+
# Build the NVIDIA variant
115+
[group('Build Variants')]
116+
build-nvidia $target_image=image_name:
117+
@just build "{{ target_image }}" "{{ default_tag }}-nvidia" "{{ base_image_nvidia }}"
118+
119+
# Build both variants (regular and NVIDIA)
120+
[group('Build Variants')]
121+
build-all $target_image=image_name:
122+
@echo "Building regular variant..."
123+
@just build-regular "{{ target_image }}"
124+
@echo "Building NVIDIA variant..."
125+
@just build-nvidia "{{ target_image }}"
126+
103127
# Command: _rootful_load_image
104128
# Description: This script checks if the current user is root or running under sudo. If not, it attempts to resolve the image tag using podman inspect.
105129
# If the image is found, it loads it into rootful podman. If the image is not found, it pulls it from the repository.

0 commit comments

Comments
 (0)