my-ostree-OS/Dockerfile

116 lines
5.4 KiB
Text
Raw Normal View History

2023-07-13 19:35:04 +02:00
ARG IMAGE_NAME="${IMAGE_NAME:-kinoite}"
ARG SOURCE_IMAGE="${SOURCE_IMAGE:-kinoite}"
ARG BASE_IMAGE="quay.io/fedora-ostree-desktops/${SOURCE_IMAGE}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}"
2023-09-16 23:08:01 +02:00
FROM fedora:38 AS akmods-builder
2023-09-16 11:03:01 +02:00
RUN dnf -y update && dnf -y install wget
RUN cd /etc/yum.repos.d/ && \
wget https://copr.fedorainfracloud.org/coprs/bieszczaders/kernel-cachyos/repo/fedora-$(rpm -E %fedora)/bieszczaders-kernel-cachyos-fedora-$(rpm -E %fedora).repo && \
wget https://copr.fedorainfracloud.org/coprs/bieszczaders/kernel-cachyos-addons/repo/fedora-$(rpm -E %fedora)/bieszczaders-kernel-cachyos-addons-fedora-$(rpm -E %fedora).repo && cd /tmp
RUN dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
2023-09-19 15:15:46 +02:00
# Update cachebust in case a rebuild is required without usage of cache.
ARG CACHEBUST=0
2023-09-16 11:47:05 +02:00
2023-09-17 10:17:38 +02:00
RUN dnf -y install kernel-cachyos-lts kernel-cachyos-lts-headers kernel-cachyos-lts-devel akmod-nvidia akmod-VirtualBox
2023-09-16 11:47:05 +02:00
COPY akmods.sh /tmp/akmods.sh
RUN /tmp/akmods.sh
2023-09-16 11:03:01 +02:00
2023-07-13 19:35:04 +02:00
FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder
ARG IMAGE_NAME="${IMAGE_NAME}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
2023-07-25 10:35:59 +02:00
# copy gpu screen recorder and gpu screen recorder gtk
COPY gpu-screen-recorder/ /tmp/gpu-screen-recorder/
COPY gpu-screen-recorder-gtk/ /tmp/gpu-screen-recorder-gtk/
2023-07-14 09:13:12 +02:00
RUN cd /etc/yum.repos.d/ && \
2023-09-15 04:36:46 +02:00
wget https://copr.fedorainfracloud.org/coprs/bieszczaders/kernel-cachyos/repo/fedora-$(rpm -E %fedora)/bieszczaders-kernel-cachyos-fedora-$(rpm -E %fedora).repo && \
2023-07-25 10:40:29 +02:00
wget https://copr.fedorainfracloud.org/coprs/bieszczaders/kernel-cachyos-addons/repo/fedora-$(rpm -E %fedora)/bieszczaders-kernel-cachyos-addons-fedora-$(rpm -E %fedora).repo && cd /tmp && \
2023-07-15 18:44:14 +02:00
# remove Okular and Firefox from base image
2023-07-25 10:35:59 +02:00
rpm-ostree override remove firefox firefox-langpacks okular && \
2023-09-17 10:17:38 +02:00
rpm-ostree install ksshaskpass uksmd-lts clang clang-devel cronie distrobox fish flatpak-builder gparted libcap-ng-devel libvirt-daemon-driver-lxc libvirt-daemon-lxc lld llvm nvtop procps-ng-devel seadrive-gui virt-manager waydroid && \
2023-07-25 00:15:36 +02:00
# install RPM-fusion
rpm-ostree install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \
# install nonfree codecs
rpm-ostree override remove libavcodec-free libavfilter-free libavformat-free libavutil-free libpostproc-free libswresample-free libswscale-free mesa-va-drivers --install libavcodec-freeworld && \
rpm-ostree install ffmpeg ffmpeg-libs intel-media-driver pipewire-codec-aptx libva-intel-driver libva-utils mesa-va-drivers-freeworld && \
# install Pulseaudio utilities
rpm-ostree install pulseaudio-utils && \
# install Kata containers
rpm-ostree install kata-containers && \
# add bore-sysctl
rpm-ostree install bore-sysctl && \
# install Apple HFS+ tools
2023-09-16 11:47:05 +02:00
rpm-ostree install hfsplus-tools && \
2023-09-19 15:15:46 +02:00
# install Nvidia software
rpm-ostree install nvidia-vaapi-driver nvidia-persistenced opencl-filesystem && \
2023-09-16 23:08:01 +02:00
# Install VirtualBox
rpm-ostree install VirtualBox && \
2023-07-25 10:29:39 +02:00
# install Mullvad VPN
mkdir /var/opt && rpm-ostree install https://mullvad.net/da/download/app/rpm/latest && \
mv "/opt/Mullvad VPN" /usr/lib/opt/ && \
# install gpu screen recorder and gpu screen recorder gtk
2023-07-25 10:35:59 +02:00
cd /tmp/gpu-screen-recorder && \
2023-07-18 13:19:45 +02:00
./install.sh && \
2023-07-25 10:29:39 +02:00
setcap cap_sys_admin+ep '/usr/bin/gsr-kms-server' && \
cd /tmp/gpu-screen-recorder-gtk && \
2023-07-25 10:35:59 +02:00
./install.sh && \
2023-09-07 15:57:24 +02:00
# enable automatic updates
sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \
2023-09-07 16:54:05 +02:00
# change auto update interval
2023-09-16 16:08:15 +02:00
sed -i 's/OnUnitInactiveSec.*/OnUnitInactiveSec=1h\nOnCalendar=*-*-* 06:40:00\nPersistent=true/' /usr/lib/systemd/system/rpm-ostreed-automatic.timer && \
2023-09-07 15:57:24 +02:00
systemctl enable rpm-ostreed-automatic.timer && \
2023-07-25 10:35:59 +02:00
# Clear cache, /var and /tmp and commit ostree
rpm-ostree cleanup -m && rm -rf /tmp/* /var/* && mkdir -p /var/tmp && chmod -R 1777 /var/tmp && \
2023-09-14 23:51:05 +02:00
ostree container commit
2023-09-16 16:08:15 +02:00
2023-09-19 15:15:46 +02:00
FROM builder AS builder2
2023-09-16 16:08:15 +02:00
COPY --from=ghcr.io/ublue-os/akmods-nvidia:38-535 /rpms /tmp/akmods-rpms
RUN rpm-ostree install \
/tmp/akmods-rpms/ublue-os/ublue-os-nvidia-addons-*.rpm
RUN rpm-ostree install \
2023-09-18 22:55:44 +02:00
xorg-x11-drv-nvidia{,-cuda,-devel,-kmodsrc} \
2023-09-16 16:08:15 +02:00
xorg-x11-drv-nvidia-libs.i686 \
2023-09-19 15:15:46 +02:00
nvidia-container-toolkit supergfxctl supergfxctl-plasmoid
2023-09-16 16:08:15 +02:00
RUN mv /etc/nvidia-container-runtime/config.toml{,.orig}
RUN cp /etc/nvidia-container-runtime/config{-rootless,}.toml
2023-09-17 01:14:37 +02:00
RUN systemctl enable supergfxd.service
2023-09-19 06:35:31 +02:00
RUN rpm-ostree uninstall xorg-x11-drv-nvidia-power
2023-09-19 15:15:46 +02:00
RUN mkdir /tmp/nvidia
COPY --from=akmods-builder /var/cache/akmods/*/* /tmp/nvidia
COPY install-nvidia.sh /tmp/install-nvidia.sh
# Enable cliwrap.
RUN rpm-ostree cliwrap install-to-root / && \
# Replace the kernel, kernel-core and kernel-modules packages.
rpm-ostree override remove kernel kernel-core kernel-modules kernel-modules-core kernel-modules-extra --install kernel-cachyos-lts && \
# install kernel headers
rpm-ostree install kernel-cachyos-lts-headers
# install akmods
RUN ls /tmp/nvidia && /tmp/install-nvidia.sh
RUN semodule --verbose --install /usr/share/selinux/packages/nvidia-container.pp
RUN ln -s /usr/bin/ld.bfd /etc/alternatives/ld
RUN ln -s /etc/alternatives/ld /usr/bin/ld
2023-09-16 16:08:15 +02:00
# Clear cache, /var and /tmp and commit ostree
RUN rpm-ostree cleanup -m && rm -rf /tmp/* /var/* && mkdir -p /var/tmp && chmod -R 1777 /var/tmp && \
ostree container commit
2023-09-19 15:15:46 +02:00