Skip to content

Commit

Permalink
chore(ci): Prevent /tmp/ from being touched in the image
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Jan 13, 2025
1 parent 7c118ca commit 369ebc2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ COPY system_files/desktop/shared system_files/desktop/${BASE_IMAGE_NAME} /
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
/ctx/unwrap && \
dnf5 -y install dnf5-plugins && \
dnf5 -y copr enable kylegospo/bazzite && \
Expand Down Expand Up @@ -112,6 +113,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=kernel,src=/tmp/rpms,dst=/tmp/kernel-rpms \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
/ctx/install-kernel && \
dnf5 -y install \
scx-scheds && \
Expand All @@ -127,6 +129,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
if [[ "${IMAGE_FLAVOR}" =~ "asus" ]]; then \
dnf5 -y copr enable lukenukem/asus-linux && \
dnf5 -y install \
Expand Down Expand Up @@ -158,6 +161,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=bind,from=akmods,src=/rpms,dst=/tmp/akmods-rpms \
--mount=type=bind,from=akmods-extra,src=/rpms,dst=/tmp/akmods-extra-rpms \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y copr enable ublue-os/akmods && \
/ctx/install-akmods && \
dnf5 -y swap \
Expand All @@ -172,6 +176,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y swap \
--repo terra-extras \
mesa-filesystem mesa-filesystem && \
Expand All @@ -197,6 +202,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y remove \
ublue-os-update-services \
firefox \
Expand All @@ -208,6 +214,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y install \
discover-overlay \
sunshine \
Expand Down Expand Up @@ -296,6 +303,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y swap \
--repo copr:copr.fedorainfracloud.org:kylegospo:bazzite \
ibus ibus && \
Expand Down Expand Up @@ -337,6 +345,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
if grep -q "kinoite" <<< "${BASE_IMAGE_NAME}"; then \
dnf5 -y install \
qt \
Expand Down Expand Up @@ -413,6 +422,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y install \
gamescope.x86_64 \
gamescope-libs.i686 \
Expand All @@ -430,6 +440,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
touch /.dockerenv && \
mkdir -p /var/home && \
mkdir -p /var/roothome && \
Expand All @@ -445,6 +456,7 @@ COPY system_files/overrides /
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
rm -f /etc/profile.d/toolbox.sh && \
mkdir -p /var/tmp && chmod 1777 /var/tmp && \
cp --no-dereference --preserve=links /usr/lib/libdrm.so.2 /usr/lib/libdrm.so && \
Expand Down Expand Up @@ -578,6 +590,8 @@ COPY system_files/deck/shared system_files/deck/${BASE_IMAGE_NAME} /
# Setup Copr repos
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y copr enable ublue-os/akmods && \
dnf5 -y copr enable kylegospo/bazzite && \
dnf5 -y copr enable kylegospo/bazzite-multilib && \
Expand All @@ -592,6 +606,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y remove \
jupiter-sd-mounting-btrfs && \
if grep -q "kinoite" <<< "${BASE_IMAGE_NAME}"; then \
Expand All @@ -613,6 +628,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y install \
jupiter-fan-control \
jupiter-hw-support-btrfs \
Expand Down Expand Up @@ -650,6 +666,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y swap \
--repo copr:copr.fedorainfracloud.org:kylegospo:bazzite \
upower upower && \
Expand All @@ -660,6 +677,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
mkdir -p /usr/share/gamescope-session-plus/ && \
curl -Lo /usr/share/gamescope-session-plus/bootstrap_steam.tar.gz https://large-package-sources.nobaraproject.org/bootstrap_steam.tar.gz && \
dnf5 -y install \
Expand All @@ -671,6 +689,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
/ctx/image-info && \
mkdir -p "/etc/xdg/autostart" && \
mv "/etc/skel/.config/autostart/steam.desktop" "/etc/xdg/autostart/steam.desktop" && \
Expand Down Expand Up @@ -762,6 +781,7 @@ COPY system_files/nvidia/shared system_files/nvidia/${BASE_IMAGE_NAME} /
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
dnf5 -y remove \
rocm-hip \
rocm-opencl \
Expand All @@ -773,6 +793,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=bind,from=nvidia-akmods,src=/rpms,dst=/tmp/akmods-rpms \
--mount=type=tmpfs,dst=/tmp \
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo && \
dnf5 -y install \
--repo terra-extras \
Expand All @@ -789,6 +810,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
echo "import \"/usr/share/ublue-os/just/95-bazzite-nvidia.just\"" >> /usr/share/ublue-os/justfile && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo && \
if grep -q "silverblue" <<< "${BASE_IMAGE_NAME}"; then \
Expand Down
1 change: 1 addition & 0 deletions build_files/cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -oue pipefail

dnf5 clean all
rm -rf /tmp/* || true

ostree container commit
1 change: 1 addition & 0 deletions build_files/finalize
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ mkdir -p /var/lib
mv /staged-alternatives /var/lib/alternatives
mkdir -p /var/tmp
chmod -R 1777 /var/tmp

ostree container commit

0 comments on commit 369ebc2

Please sign in to comment.