chore: Optimize containerfile to remove tiny layers

This commit is contained in:
Kyle Gospodnetich 2023-07-28 00:17:26 -07:00
parent 7e566e7a76
commit 0919a4a5fc

View File

@ -9,23 +9,11 @@ FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS bazzite
ARG IMAGE_NAME="${IMAGE_NAME}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
COPY system_files/desktop/etc /etc
COPY system_files/desktop/usr /usr
COPY system_files/desktop /
# Add ublue packages
RUN sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
COPY --from=ghcr.io/ublue-os/akmods:${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
COPY --from=ghcr.io/ublue-os/ublue-update:latest /rpms/ublue-update.noarch.rpm /tmp/rpms/ublue-update.noarch.rpm
COPY --from=ghcr.io/ublue-os/bling:latest /rpms/ublue-os-wallpapers-*.noarch.rpm /tmp/rpms/ublue-os-wallpapers.rpm
RUN rpm-ostree override remove ublue-os-update-services && \
rpm-ostree install \
/tmp/akmods-rpms/kmods/*gcadapter_oc*.rpm \
/tmp/akmods-rpms/kmods/*openrgb*.rpm \
/tmp/rpms/ublue-update.noarch.rpm \
/tmp/rpms/ublue-os-wallpapers.rpm
# Add Copr repos
RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite/repo/fedora-$(rpm -E %fedora)/kylegospo-bazzite-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
# Setup Copr repos
RUN sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo && \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite/repo/fedora-$(rpm -E %fedora)/kylegospo-bazzite-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/system76-scheduler/repo/fedora-$(rpm -E %fedora)/kylegospo-system76-scheduler-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-system76-scheduler.repo && \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/hl2linux-selinux/repo/fedora-$(rpm -E %fedora)/kylegospo-hl2linux-selinux-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-hl2linux-selinux.repo && \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/obs-vkcapture/repo/fedora-$(rpm -E %fedora)/kylegospo-obs-vkcapture-fedora-$(rpm -E %fedora).repo?arch=x86_64 -O /etc/yum.repos.d/_copr_kylegospo-obs-vkcapture.repo && \
@ -33,6 +21,26 @@ RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite/repo/fedora-$
wget https://copr.fedorainfracloud.org/coprs/kylegospo/gnome-vrr/repo/fedora-$(rpm -E %fedora)/kylegospo-gnome-vrr-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-gnome-vrr.repo && \
wget https://copr.fedorainfracloud.org/coprs/ycollet/audinux/repo/fedora-$(rpm -E %fedora)/ycollet-audinux-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_ycollet-audinux.repo
# Add ublue packages
COPY --from=ghcr.io/ublue-os/akmods:${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
COPY --from=ghcr.io/ublue-os/ublue-update:latest /rpms/ublue-update.noarch.rpm /tmp/rpms/ublue-update.noarch.rpm
COPY --from=ghcr.io/ublue-os/bling:latest /rpms/ublue-os-wallpapers-*.noarch.rpm /tmp/rpms/ublue-os-wallpapers.rpm
RUN rpm-ostree install \
/tmp/akmods-rpms/kmods/*gcadapter_oc*.rpm \
/tmp/akmods-rpms/kmods/*openrgb*.rpm \
/tmp/rpms/ublue-update.noarch.rpm \
/tmp/rpms/ublue-os-wallpapers.rpm
# Remove unneeded packages
RUN rpm-ostree override remove \
ublue-os-update-services \
firefox \
firefox-langpacks \
plasma-welcome \
toolbox \
htop \
qt5-qdbusviewer
# Install new packages
RUN rpm-ostree install \
python3-pip \
@ -58,15 +66,6 @@ RUN rpm-ostree install \
neofetch \
fish
# Remove unneeded packages
RUN rpm-ostree override remove \
firefox \
firefox-langpacks \
plasma-welcome \
toolbox \
htop \
qt5-qdbusviewer
# Install newer Xwayland
RUN rpm-ostree override replace --experimental --from repo=copr:copr.fedorainfracloud.org:kylegospo:gnome-vrr xorg-x11-server-Xwayland
@ -77,13 +76,11 @@ RUN if grep -v "nvidia" <<< "${IMAGE_NAME}"; then \
rocm-opencl \
; fi
# Run firstboot script per-profile
RUN mkdir -p "/usr/etc/profile.d/"
RUN ln -s "/usr/share/ublue-os/firstboot/launcher/login-profile.sh" \
"/usr/etc/profile.d/ublue-firstboot.sh"
# Cleanup & Finalize
RUN pip install --prefix=/usr yafti && \
RUN mkdir -p "/usr/etc/profile.d/" && \
ln -s "/usr/share/ublue-os/firstboot/launcher/login-profile.sh" \
"/usr/etc/profile.d/ublue-firstboot.sh" && \
pip install --prefix=/usr yafti && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-system76-scheduler.repo && \
@ -110,18 +107,12 @@ FROM bazzite as bazzite-deck
ARG IMAGE_NAME="${IMAGE_NAME}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
COPY system_files/deck/etc /etc
COPY system_files/deck/usr /usr
RUN ln -s /usr/bin/steamos-logger /usr/bin/steamos-info && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-notice && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-warning
# Add Multilib Bazzite and LatencyFleX Copr repos
RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite-multilib/repo/fedora-$(rpm -E %fedora)/kylegospo-bazzite-multilib-fedora-$(rpm -E %fedora).repo?arch=x86_64 -O /etc/yum.repos.d/_copr_kylegospo-bazzite-multilib.repo && \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/LatencyFleX/repo/fedora-$(rpm -E %fedora)/kylegospo-LatencyFleX-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-latencyflex.repo
COPY system_files/deck /
# Re-enable Copr repos
RUN sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo && \
# Setup Copr repos
RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite-multilib/repo/fedora-$(rpm -E %fedora)/kylegospo-bazzite-multilib-fedora-$(rpm -E %fedora).repo?arch=x86_64 -O /etc/yum.repos.d/_copr_kylegospo-bazzite-multilib.repo && \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/LatencyFleX/repo/fedora-$(rpm -E %fedora)/kylegospo-LatencyFleX-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-latencyflex.repo && \
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo && \
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_kylegospo-hl2linux-selinux.repo && \
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_kylegospo-obs-vkcapture.repo && \
@ -142,11 +133,12 @@ RUN rpm-ostree override replace --experimental --from repo=copr:copr.fedorainfra
mesa-libglapi \
mesa-vulkan-drivers
# Remove steamdeck-kde-presets-desktop
RUN rpm-ostree override remove steamdeck-kde-presets-desktop
# Remove ublue-os-wallpapers
RUN rpm-ostree override remove ublue-os-wallpapers
# Remove unneeded packages
RUN rpm-ostree override remove \
krfb \
krfb-libs \
ublue-os-wallpapers \
steamdeck-kde-presets-desktop
# Install patched udisks2 (Needed for SteamOS SD card mounting)
RUN rpm-ostree override replace --experimental --from repo=copr:copr.fedorainfracloud.org:kylegospo:bazzite udisks2
@ -176,20 +168,16 @@ RUN rpm-ostree install \
python-vdf \
python-crcmod
# Remove unneeded packages
RUN rpm-ostree override remove \
krfb \
krfb-libs
# Install dock updater, this is done manually due to proprietary parts preventing it from being on Copr
RUN git clone https://gitlab.com/evlaV/jupiter-dock-updater-bin.git --depth 1 /tmp/jupiter-dock-updater-bin && \
mv -v /tmp/jupiter-dock-updater-bin/packaged/usr/lib/jupiter-dock-updater /usr/lib/jupiter-dock-updater
# Suspend using power button
RUN sed -i 's/#HandlePowerKey=poweroff/HandlePowerKey=suspend/g' /etc/systemd/logind.conf
# Cleanup & Finalize
RUN sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo && \
RUN ln -s /usr/bin/steamos-logger /usr/bin/steamos-info && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-notice && \
ln -s /usr/bin/steamos-logger /usr/bin/steamos-warning && \
sed -i 's/#HandlePowerKey=poweroff/HandlePowerKey=suspend/g' /etc/systemd/logind.conf && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-bazzite-multilib.repo && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-latencyflex.repo && \