-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add generic fcos build with nvidia (#95)
- Loading branch information
Showing
6 changed files
with
128 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ARG COREOS_VERSION="${COREOS_VERSION:-stable}" | ||
|
||
FROM quay.io/fedora/fedora-coreos:${COREOS_VERSION} | ||
|
||
ARG COREOS_VERSION="${COREOS_VERSION:-stable}" | ||
# build with --build-arg NVIDA_TAG="-nvidia" to install nvidia | ||
ARG NVIDIA_TAG="${NVIDIA_TAG}" | ||
# build with --build-arg ZFS_TAG="-zfs" to install zfs | ||
ARG ZFS_TAG="${ZFS_TAG}" | ||
ARG KMOD_SRC="${KMOD_SRC:-ghcr.io/ublue-os/ucore-kmods:${COREOS_VERSION}}" | ||
|
||
COPY --from=${KMOD_SRC} /rpms/kmods/nvidia/*.rpm /tmp/rpms/nvidia/ | ||
COPY --from=${KMOD_SRC} /rpms/kmods/zfs/*.rpm /tmp/rpms/zfs/ | ||
|
||
COPY *.sh /tmp/ | ||
|
||
RUN mkdir -p /var/lib/alternatives \ | ||
&& /tmp/install.sh \ | ||
&& /tmp/post-install.sh \ | ||
&& mv /var/lib/alternatives /staged-alternatives \ | ||
&& rm -fr /tmp/* /var/* \ | ||
&& ostree container commit \ | ||
&& mkdir -p /var/lib && mv /staged-alternatives /var/lib/alternatives \ | ||
&& mkdir -p /tmp /var/tmp \ | ||
&& chmod -R 1777 /tmp /var/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
set -ouex pipefail | ||
|
||
RELEASE="$(rpm -E %fedora)" | ||
|
||
#### PREPARE | ||
# enable testing repos if not enabled on testing stream | ||
if [[ "testing" == "${COREOS_VERSION}" ]]; then | ||
for REPO in $(ls /etc/yum.repos.d/fedora-updates-testing{,-modular}.repo); do | ||
if [[ "$(grep enabled=1 ${REPO} > /dev/null; echo $?)" == "1" ]]; then | ||
echo "enabling $REPO" && | ||
sed -i '0,/enabled=0/{s/enabled=0/enabled=1/}' ${REPO} | ||
fi | ||
done | ||
fi | ||
|
||
# always disable cisco-open264 repo | ||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo | ||
|
||
#### INSTALL | ||
# inspect to see what RPMS we copied in | ||
find /tmp/rpms/ | ||
|
||
## CONDITIONAL: install ZFS (and sanoid deps) | ||
if [[ "-zfs" == "${ZFS_TAG}" ]]; then | ||
rpm-ostree install pv /tmp/rpms/zfs/*.rpm | ||
fi | ||
|
||
## CONDITIONAL: install NVIDIA | ||
if [[ "-nvidia" == "${NVIDIA_TAG}" ]]; then | ||
# repo for nvidia rpms | ||
curl -L https://negativo17.org/repos/fedora-nvidia.repo -o /etc/yum.repos.d/fedora-nvidia.repo | ||
|
||
rpm-ostree install /tmp/rpms/nvidia/ublue-os-ucore-nvidia-*.rpm | ||
sed -i '0,/enabled=0/{s/enabled=0/enabled=1/}' /etc/yum.repos.d/nvidia-container-toolkit.repo | ||
|
||
rpm-ostree install \ | ||
/tmp/rpms/nvidia/kmod-nvidia-*.rpm \ | ||
nvidia-driver-cuda \ | ||
nvidia-container-toolkit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -ouex pipefail | ||
|
||
## CONDITIONAL: post-install ZFS | ||
if [[ "-zfs" == "${ZFS_TAG}" ]]; then | ||
echo "no post-install tasks for ZFS" | ||
fi | ||
|
||
## CONDITIONAL: post-install NVIDIA | ||
if [[ "-nvidia" == "${NVIDIA_TAG}" ]]; then | ||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/nvidia-container-toolkit.repo | ||
|
||
semodule --verbose --install /usr/share/selinux/packages/nvidia-container.pp | ||
fi |