|
1 | 1 | export image_name := env("IMAGE_NAME", "image-template") # output image name, usually same as repo name, change as needed |
2 | 2 | export default_tag := env("DEFAULT_TAG", "latest") |
3 | 3 | 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") |
4 | 6 |
|
5 | 7 | alias build-vm := build-qcow2 |
6 | 8 | alias rebuild-vm := rebuild-qcow2 |
@@ -73,33 +75,55 @@ sudoif command *args: |
73 | 75 | # Arguments: |
74 | 76 | # $target_image - The tag you want to apply to the image (default: $image_name). |
75 | 77 | # $tag - The tag for the image (default: $default_tag). |
| 78 | +# $base_img - The base image to use (default: $base_image). |
76 | 79 | # |
77 | 80 | # The script constructs the version string using the tag and the current date. |
78 | 81 | # If the git working directory is clean, it also includes the short SHA of the current HEAD. |
79 | 82 | # |
80 | | -# just build $target_image $tag |
| 83 | +# just build $target_image $tag $base_img |
81 | 84 | # |
82 | 85 | # 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 |
84 | 88 | # |
85 | | -# This will build an image 'aurora:lts' with DX and GDX enabled. |
| 89 | +# This will build an image with the specified base image. |
86 | 90 | # |
87 | 91 |
|
88 | 92 | # 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: |
90 | 94 | #!/usr/bin/env bash |
91 | 95 |
|
92 | 96 | BUILD_ARGS=() |
| 97 | + BUILD_ARGS+=("--build-arg" "BASE_IMAGE={{ base_img }}") |
| 98 | + |
93 | 99 | if [[ -z "$(git status -s)" ]]; then |
94 | 100 | BUILD_ARGS+=("--build-arg" "SHA_HEAD_SHORT=$(git rev-parse --short HEAD)") |
95 | 101 | fi |
96 | 102 |
|
97 | 103 | podman build \ |
98 | 104 | "${BUILD_ARGS[@]}" \ |
99 | 105 | --pull=newer \ |
100 | | - --tag "${target_image}:${tag}" \ |
| 106 | + --tag "{{ target_image }}:{{ tag }}" \ |
101 | 107 | . |
102 | 108 |
|
| 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 | + |
103 | 127 | # Command: _rootful_load_image |
104 | 128 | # 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. |
105 | 129 | # 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