Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
feat: Reduce image size and complexity (#40)
Browse files Browse the repository at this point in the history
- Reduce number of copies
- Remove redundant container commit
- Make scripts executable
  • Loading branch information
EyeCantCU authored Oct 21, 2023
1 parent cf7691f commit 8fee88e
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 151 deletions.
11 changes: 1 addition & 10 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}"

FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder

COPY etc /etc
COPY usr /usr
RUN chmod +x /etc/ublue-lightdm-workaround.sh

ARG IMAGE_NAME="${IMAGE_NAME}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"

ADD packages.json /tmp/packages.json
ADD build.sh /tmp/build.sh
COPY system_files /

RUN /tmp/build.sh && \
pip install --prefix=/usr yafti && \
Expand All @@ -25,7 +20,3 @@ RUN /tmp/build.sh && \
ostree container commit && \
mkdir -p /var/tmp && \
chmod -R 1777 /var/tmp

COPY config/touchegg.conf /usr/share/touchegg

RUN ostree container commit
35 changes: 0 additions & 35 deletions build.sh

This file was deleted.

1 change: 1 addition & 0 deletions build.sh
106 changes: 0 additions & 106 deletions packages.json

This file was deleted.

1 change: 1 addition & 0 deletions packages.json
35 changes: 35 additions & 0 deletions system_files/tmp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

set -ouex pipefail

RELEASE="$(rpm -E %fedora)"

INCLUDED_PACKAGES=($(jq -r "[(.all.include | (.all, select(.\"$IMAGE_NAME\" != null).\"$IMAGE_NAME\")[]), \
(select(.\"$FEDORA_MAJOR_VERSION\" != null).\"$FEDORA_MAJOR_VERSION\".include | (.all, select(.\"$IMAGE_NAME\" != null).\"$IMAGE_NAME\")[])] \
| sort | unique[]" /tmp/packages.json))
EXCLUDED_PACKAGES=($(jq -r "[(.all.exclude | (.all, select(.\"$IMAGE_NAME\" != null).\"$IMAGE_NAME\")[]), \
(select(.\"$FEDORA_MAJOR_VERSION\" != null).\"$FEDORA_MAJOR_VERSION\".exclude | (.all, select(.\"$IMAGE_NAME\" != null).\"$IMAGE_NAME\")[])] \
| sort | unique[]" /tmp/packages.json))


if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
EXCLUDED_PACKAGES=($(rpm -qa --queryformat='%{NAME} ' ${EXCLUDED_PACKAGES[@]}))
fi

if [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#EXCLUDED_PACKAGES[@]}" -eq 0 ]]; then
rpm-ostree install \
${INCLUDED_PACKAGES[@]}

elif [[ "${#INCLUDED_PACKAGES[@]}" -eq 0 && "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${EXCLUDED_PACKAGES[@]}

elif [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${EXCLUDED_PACKAGES[@]} \
$(printf -- "--install=%s " ${INCLUDED_PACKAGES[@]})

else
echo "No packages to install."

fi
106 changes: 106 additions & 0 deletions system_files/tmp/packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"all": {
"include": {
"all": [
"gnome-boxes",
"gnome-software",
"python3-pip",
"timeshift",
"touchegg",
"NetworkManager-adsl",
"NetworkManager-bluetooth",
"NetworkManager-iodine-gnome",
"NetworkManager-l2tp-gnome",
"NetworkManager-libreswan-gnome",
"NetworkManager-openconnect-gnome",
"NetworkManager-openvpn-gnome",
"NetworkManager-ppp",
"NetworkManager-pptp-gnome",
"NetworkManager-vpnc-gnome",
"NetworkManager-wifi",
"NetworkManager-wwan",
"abrt-desktop",
"abrt-java-connector",
"blueman",
"cinnamon",
"cinnamon-control-center",
"cinnamon-screensaver",
"eom",
"ffmpegthumbnailer",
"firewall-config",
"gnome-disk-utility",
"gnome-screenshot",
"gnome-system-monitor",
"gnome-terminal",
"gstreamer1-plugins-ugly-free",
"gvfs-archive",
"gvfs-gphoto2",
"gvfs-mtp",
"gvfs-smb",
"imsettings-gsettings",
"initial-setup-gui",
"metacity",
"nemo-fileroller",
"nemo-image-converter",
"nemo-preview",
"nemo-python",
"nm-connection-editor",
"paper-icon-theme",
"pipewire-alsa",
"pipewire-pulseaudio",
"powerline",
"qgnomeplatform-qt5",
"redshift-gtk",
"sane-backends-drivers-scanners",
"setroubleshoot",
"simple-scan",
"slick-greeter",
"slick-greeter-cinnamon",
"system-config-printer",
"tmux",
"tmux-powerline",
"vim-powerline",
"xawtv",
"xdg-user-dirs-gtk",
"xed",
"xfburn",
"xreader"
]
},
"exclude": {
"all": [
"firefox",
"firefox-langpacks"
]
}
},
"37": {
"include": {
"all": [
"raw-thumbnailer"
]
},
"exclude": {
"all": []
}
},
"38": {
"include": {
"all": [
"raw-thumbnailer"
]
},
"exclude": {
"all": [
]
}
},
"39": {
"include": {
"all": []
},
"exclude": {
"all": []
}
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit 8fee88e

Please sign in to comment.