Skip to content

Commit e23f046

Browse files
committed
feat: updates Containerfile to straight up use silverblue-nvidia:42
1 parent 2c0c2a5 commit e23f046

1 file changed

Lines changed: 9 additions & 84 deletions

File tree

Containerfile

Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,16 @@
1-
# Simplified Containerfile for Fedora Silverblue with NVIDIA drivers
2-
# Based on ublue-os/main
3-
# Scripts are fetched directly from ublue-os/main repo - no local maintenance needed!
4-
5-
# Build configuration
61
ARG FEDORA_VERSION="${FEDORA_VERSION:-42}"
7-
ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}"
8-
9-
# Image sources
10-
ARG UBLUE_REGISTRY="ghcr.io/ublue-os"
11-
ARG FEDORA_IMAGE="quay.io/fedora-ostree-desktops/silverblue"
12-
13-
# Optional digest pinning for reproducible builds
14-
ARG BASE_IMAGE_DIGEST=""
15-
ARG AKMODS_DIGEST=""
16-
ARG NVIDIA_AKMODS_DIGEST=""
17-
18-
# Stage 1: Clone ublue-os/main and merge packages
19-
FROM alpine/git AS buildctx
20-
RUN apk add --no-cache yq jq
21-
22-
RUN <<EOF
23-
git_branch="main"
24-
echo "Cloning ublue-os/main repo (branch: $git_branch)..."
25-
git clone --depth=1 --branch "${git_branch}" \
26-
https://github.com/ublue-os/main.git ./ublue-os
27-
mv ublue-os/sys_files /
28-
mv ublue-os/build_files/* /
29-
mv ublue-os/packages.json /ublue-packages.json
30-
EOF
31-
32-
COPY packages.yml /
33-
34-
RUN <<EOF
35-
set -ex
36-
echo "Merging ublue packages with custom packages..."
37-
38-
# Convert your YAML packages to JSON array
39-
yq -o=json /packages.yml > /additional-packages.json
402

41-
jq --slurpfile pkgs /additional-packages.json \
42-
'.all.include.silverblue += $pkgs[0].packages' \
43-
/ublue-packages.json > /packages.json
44-
45-
echo "also installing user packages"
46-
jq -r '.all.include.silverblue' </packages.json
47-
EOF
48-
49-
# Stage 2: Get kernel modules from ublue-os
50-
FROM ${UBLUE_REGISTRY}/akmods:main-${FEDORA_VERSION}${AKMODS_DIGEST:+@${AKMODS_DIGEST}} AS akmods
51-
52-
# Stage 3: Get NVIDIA drivers from ublue-os
53-
FROM ${UBLUE_REGISTRY}/akmods-nvidia-open:main-${FEDORA_VERSION}${NVIDIA_AKMODS_DIGEST:+@${NVIDIA_AKMODS_DIGEST}} AS nvidia_akmods
54-
55-
# Stage 4: Build final image
56-
FROM ${FEDORA_IMAGE}:${FEDORA_VERSION}${BASE_IMAGE_DIGEST:+@${BASE_IMAGE_DIGEST}}
57-
58-
# Re-declare ARGs for use in this stage
3+
FROM ghcr.io/ublue-os/silverblue-nvidia:${FEDORA_VERSION}
594
ARG FEDORA_VERSION="${FEDORA_VERSION:-42}"
60-
ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}"
61-
ARG UBLUE_MAIN_VERSION="${UBLUE_MAIN_VERSION:-main}"
625

63-
# Download build scripts from ublue-os/main repo and execute
64-
RUN --mount=type=bind,from=buildctx,src=/,dst=/ctx \
65-
--mount=type=bind,from=akmods,src=/rpms/ublue-os,dst=/tmp/akmods-rpms \
66-
--mount=type=bind,from=akmods,src=/kernel-rpms,dst=/tmp/kernel-rpms \
67-
--mount=type=bind,from=nvidia_akmods,src=/rpms,dst=/tmp/akmods-nv-rpms \
68-
--mount=type=cache,target=/var/cache \
69-
--mount=type=cache,target=/var/log \
70-
<<EOF
71-
set -ouex pipefail
6+
# Customized Branding
7+
RUN sed -i "s|^NAME=.*|NAME=nxtcoder17 edition silverblue ${FEDORA_VERSION}|" /usr/lib/os-release && \
8+
sed -i "s|^PRETTY_NAME=.*|PRETTY_NAME=nxtcoder17 edition silverblue ${FEDORA_VERSION}|" /usr/lib/os-releas
729

73-
rm -f /usr/bin/chsh /usr/bin/lchsh
74-
75-
echo "Running ublue-os build scripts..."
76-
/ctx/install.sh
77-
78-
AKMODNV_PATH=/tmp/akmods-nv-rpms /ctx/nvidia-install.sh
79-
80-
/ctx/initramfs.sh
81-
/ctx/post-install.sh
10+
RUN <<EOF
11+
set -ex
12+
rpm-ostree install docker distrobox hyprland
13+
rpm-ostree cleanup -m
14+
ostree container commit
8215
EOF
8316

84-
# Validate the image
85-
RUN ["bootc", "container", "lint"]
86-
87-
# RUN rpm-ostree override remove firefox firefox-langpacks
88-
# RUN rpm-ostree cleanup -m
89-
#
90-
# RUN sed -i "s|^NAME=.*|NAME=nxtcoder17 edition silverblue ${FEDORA_VERSION}|" /usr/lib/os-release
91-
# RUN sed -i "s|^PRETTY_NAME=.*|PRETTY_NAME=nxtcoder17 edition silverblue ${FEDORA_VERSION}|" /usr/lib/os-release

0 commit comments

Comments
 (0)