Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reorganize repo for Aurora builds #1091

Merged
merged 12 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
image_flavor: surface
- major_version: 38
image_flavor: surface-nvidia
- major_version: 40
image_flavor: framework

steps:
- name: Checkout
Expand Down Expand Up @@ -88,6 +90,16 @@ jobs:
else
echo "IMAGE_NAME=${{ format('{0}-{1}', matrix.base_name, matrix.image_flavor) }}" >> $GITHUB_ENV
fi
if [[ "${{ matrix.base_name }}" =~ "bluefin" ]]; then
echo "BASE_IMAGE_NAME"="silverblue" >> $GITHUB_ENV
elif [[ "${{ matrix.base_name }}" =~ "aurora" ]]; then
echo "BASE_IMAGE_NAME"="kinoite" >> $GITHUB_ENV
fi
if [[ "${{ matrix.base_name }}" =~ "dx" ]]; then
echo "TARGET_NAME"="dx" >> $GITHUB_ENV
else
echo "TARGET_NAME"="base" >> $GITHUB_ENV
fi
if [[ "${{ matrix.image_flavor }}" =~ "asus" ]]; then
echo "AKMODS_FLAVOR=asus" >> $GITHUB_ENV
elif [[ "${{ matrix.image_flavor }}" =~ "surface" ]]; then
Expand Down Expand Up @@ -184,6 +196,7 @@ jobs:
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
BASE_IMAGE_NAME=${{ env.BASE_IMAGE_NAME }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
IMAGE_FLAVOR=${{ matrix.image_flavor }}
IMAGE_VENDOR=${{ github.repository_owner }}
Expand All @@ -196,7 +209,7 @@ jobs:
# extra-args: |
# --target=${{ matrix.target_name || matrix.base_name }}
extra-args: |
--target=${{ matrix.base_name }}
--target=${{ env.TARGET_NAME }}

# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
Expand Down
166 changes: 21 additions & 145 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,178 +7,54 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}"
ARG TARGET_BASE="${TARGET_BASE:-bluefin}"

## bluefin image section
FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS bluefin
FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS base

ARG IMAGE_NAME="${IMAGE_NAME}"
ARG IMAGE_VENDOR="${IMAGE_VENDOR}"
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
ARG AKMODS_FLAVOR="${AKMODS_FLAVOR}"
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
ARG PACKAGE_LIST="bluefin"


# Add Staging repo
RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
# 39 gets VRR and Ptyxis
if [ ${FEDORA_MAJOR_VERSION} -eq "39" ]; then \
wget https://copr.fedorainfracloud.org/coprs/kylegospo/gnome-vrr/repo/fedora-"${FEDORA_MAJOR_VERSION}"/kylegospo-gnome-vrr-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/_copr_kylegospo-gnome-vrr.repo && \
rpm-ostree override replace --experimental --from repo=copr:copr.fedorainfracloud.org:kylegospo:gnome-vrr mutter mutter-common gnome-control-center gnome-control-center-filesystem && \
rm -f /etc/yum.repos.d/_copr_kylegospo-gnome-vrr.repo && \
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
gtk4 \
vte291 \
vte-profile \
libadwaita && \
rpm-ostree install \
ptyxis \
; fi && \
# 40 gets only Ptyxis
if [ ${FEDORA_MAJOR_VERSION} -eq "40" ]; then \
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
vte291 \
vte-profile && \
rpm-ostree install \
ptyxis \
; fi

# Install Explicit Sync Patches on Nvidia builds
RUN if [[ "${IMAGE_FLAVOR}" =~ "nvidia" && "${IMAGE_FLAVOR}" =~ "39" ]]; then \
wget https://copr.fedorainfracloud.org/coprs/gloriouseggroll/nvidia-explicit-sync/repo/fedora-$(rpm -E %fedora)/gloriouseggroll-nvidia-explicit-sync-fedora-$(rpm -E %fedora).repo?arch=x86_64 -O /etc/yum.repos.d/_copr_gloriouseggroll-nvidia-explicit-sync.repo && \
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:gloriouseggroll:nvidia-explicit-sync \
xorg-x11-server-Xwayland && \
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:gloriouseggroll:nvidia-explicit-sync \
egl-wayland \
|| true && \
rm /etc/yum.repos.d/_copr_gloriouseggroll-nvidia-explicit-sync.repo \
; fi

COPY usr /usr
# COPY Build Files
COPY build_files/base build_files/shared /tmp/build/
COPY system_files/shared system_files/${BASE_IMAGE_NAME} /
COPY just /tmp/just
COPY etc/yum.repos.d/ /etc/yum.repos.d/
COPY packages.json /tmp/packages.json
COPY build.sh /tmp/build.sh
COPY image-info.sh /tmp/image-info.sh
COPY install-akmods.sh /tmp/install-akmods.sh
COPY fetch-quadlets.sh /tmp/fetch-quadlets.sh
# Copy ublue-update.toml to tmp first, to avoid being overwritten.
COPY usr/etc/ublue-update/ublue-update.toml /tmp/ublue-update.toml

# Add ublue kmods, add needed negativo17 repo and then immediately disable due to incompatibility with RPMFusion
COPY --from=ghcr.io/ublue-os/akmods:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
RUN /tmp/install-akmods.sh && \
wget https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-"${FEDORA_MAJOR_VERSION}"/che-nerd-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo

# Starship Shell Prompt
RUN curl -Lo /tmp/starship.tar.gz "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz" && \
tar -xzf /tmp/starship.tar.gz -C /tmp && \
install -c -m 0755 /tmp/starship /usr/bin && \
echo 'eval "$(starship init bash)"' >> /etc/bashrc

# Copy ublue-update.toml to tmp first, to avoid being overwritten.
COPY /system_files/shared/usr/etc/ublue-update/ublue-update.toml /tmp/ublue-update.toml
# Copy Bluefin CLI packages
COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/bin/atuin /usr/bin/atuin
COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/share/bash-prexec /usr/share/bash-prexec
# COPY ublue kmods, add needed negativo17 repo and then immediately disable due to incompatibility with RPMFusion
COPY --from=ghcr.io/ublue-os/akmods:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for this PR, but a thought - would it be good to move this to scripts too, and use skopeo or similar to extract these files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be nicer. We could remove a few of these COPY layers with that.


RUN wget https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -O /usr/libexec/brew-install && \
chmod +x /usr/libexec/brew-install && \
/tmp/build.sh && \
/tmp/image-info.sh && \
/tmp/fetch-quadlets.sh && \
pip install --prefix=/usr topgrade && \
rpm-ostree install ublue-update && \
mkdir -p /usr/etc/flatpak/remotes.d && \
wget -q https://dl.flathub.org/repo/flathub.flatpakrepo -P /usr/etc/flatpak/remotes.d && \
cp /tmp/ublue-update.toml /usr/etc/ublue-update/ublue-update.toml && \
if [[ "${FEDORA_MAJOR_VERSION}" -ge "39" ]]; then \
systemctl enable tuned.service \
; fi && \
systemctl enable rpm-ostree-countme.service && \
systemctl enable tailscaled.service && \
systemctl enable dconf-update.service && \
systemctl --global enable ublue-flatpak-manager.service && \
systemctl enable ublue-update.timer && \
systemctl enable ublue-system-setup.service && \
systemctl --global enable ublue-user-setup.service && \
fc-cache -f /usr/share/fonts/ubuntu && \
fc-cache -f /usr/share/fonts/inter && \
find /tmp/just -iname '*.just' -exec printf "\n\n" \; -exec cat {} \; >> /usr/share/ublue-os/just/60-custom.just && \
rm -f /etc/yum.repos.d/tailscale.repo && \
rm -f /etc/yum.repos.d/charm.repo && \
rm -f /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
echo "Hidden=true" >> /usr/share/applications/fish.desktop && \
echo "Hidden=true" >> /usr/share/applications/htop.desktop && \
echo "Hidden=true" >> /usr/share/applications/nvtop.desktop && \
echo "Hidden=true" >> /usr/share/applications/gnome-system-monitor.desktop && \
rm -f /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo && \
sed -i '/^PRETTY_NAME/s/Silverblue/Bluefin/' /usr/lib/os-release && \
# Build, cleanup, commit.
RUN bash -c ". /tmp/build/build-base.sh" && \
rm -rf /tmp/* /var/* && \
ostree container commit && \
mkdir -p /var/tmp && \
chmod -R 1777 /var/tmp
chmod -R 1777 /var/tmp && \
ostree container commit

## bluefin-dx developer edition image section
FROM bluefin AS bluefin-dx
FROM base AS dx

ARG IMAGE_NAME="${IMAGE_NAME}"
ARG IMAGE_VENDOR="${IMAGE_VENDOR}"
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
ARG PACKAGE_LIST="bluefin-dx"

# dx specific files come from the dx directory in this repo
COPY dx/usr /usr
COPY dx/etc/yum.repos.d/ /etc/yum.repos.d/
COPY workarounds.sh \
packages.json \
build.sh \
image-info.sh \
/tmp

# Apply IP Forwarding before installing Docker to prevent messing with LXC networking
RUN sysctl -p

RUN wget https://copr.fedorainfracloud.org/coprs/ganto/lxc4/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
wget https://copr.fedorainfracloud.org/coprs/karmab/kcli/repo/fedora-"${FEDORA_MAJOR_VERSION}"/karmab-kcli-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/karmab-kcli-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
wget https://copr.fedorainfracloud.org/coprs/atim/ubuntu-fonts/repo/fedora-"${FEDORA_MAJOR_VERSION}"/atim-ubuntu-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/atim-ubuntu-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo

# Handle packages via packages.json
RUN /tmp/build.sh && \
/tmp/image-info.sh

RUN curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/latest/download/kind-$(uname)-amd64" && \
chmod +x ./kind && \
mv ./kind /usr/bin/kind

# Set up services
RUN systemctl enable docker.socket && \
systemctl enable podman.socket && \
systemctl enable swtpm-workaround.service && \
systemctl enable bluefin-dx-groups.service && \
systemctl enable --global bluefin-dx-user-vscode.service && \
systemctl disable pmie.service && \
systemctl disable pmlogger.service

RUN /tmp/workarounds.sh
COPY build_files/dx build_files/shared /tmp/build/
COPY system_files/dx /
COPY packages.json /tmp/packages.json

# Clean up repos, everything is on the image so we don't need them
RUN rm -f /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
rm -f /etc/yum.repos.d/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
rm -f /etc/yum.repos.d/karmab-kcli-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
rm -f /etc/yum.repos.d/atim-ubuntu-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
rm -f /etc/yum.repos.d/vscode.repo && \
rm -f /etc/yum.repos.d/docker-ce.repo && \
rm -f /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:phracek:PyCharm.repo && \
rm -f /etc/yum.repos.d/fedora-cisco-openh264.repo && \
# Build, Clean-up, Commit
RUN bash -c ". /tmp/build/build-dx.sh" && \
fc-cache --system-only --really-force --verbose && \
rm -rf /tmp/* /var/* && \
ostree container commit
mkdir -p /var/tmp && \
chmod -R 1777 /var/tmp && \
ostree container commit
9 changes: 9 additions & 0 deletions build_files/base/branding.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/bash

set -oue pipefail

if test "$BASE_IMAGE_NAME" = "silverblue"; then
sed -i '/^PRETTY_NAME/s/Silverblue/Bluefin/' /usr/lib/os-release
elif test "$BASE_IMAGE_NAME" = "kinoite"; then
sed -i '/^PRETTY_NAME/s/Kinoite/Aurora/' /usr/lib/os-release
fi
17 changes: 17 additions & 0 deletions build_files/base/build-base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/bash

set -oue pipefail

. /tmp/build/copr-repos.sh
. /tmp/build/nvidia-explicit-sync.sh
. /tmp/build/install-akmods.sh
. /tmp/build/packages.sh
. /tmp/build/fetch-install.sh
rpm-ostree install ublue-update
. /tmp/build/image-info.sh
. /tmp/build/fetch-quadlets.sh
. /tmp/build/font-install.sh
. /tmp/build/install-tmp.sh
. /tmp/build/systemd.sh
. /tmp/build/branding.sh
. /tmp/build/cleanup.sh
14 changes: 14 additions & 0 deletions build_files/base/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/bash

set -ouex pipefail

rm -f /etc/yum.repos.d/tailscale.repo
rm -f /etc/yum.repos.d/charm.repo
rm -f /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo
echo "Hidden=true" >> /usr/share/applications/fish.desktop
echo "Hidden=true" >> /usr/share/applications/htop.desktop
echo "Hidden=true" >> /usr/share/applications/nvtop.desktop
if [ "$BASE_IMAGE_NAME" = "silverblue" ]; then
echo "Hidden=true" >> /usr/share/applications/gnome-system-monitor.desktop
fi
rm -f /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo
31 changes: 31 additions & 0 deletions build_files/base/copr-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/bash

set -oue pipefail

# Add Staging repo
wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo
# 39 gets VRR and Ptyxis
if [ ${FEDORA_MAJOR_VERSION} -eq "39" ]; then
wget https://copr.fedorainfracloud.org/coprs/kylegospo/gnome-vrr/repo/fedora-"${FEDORA_MAJOR_VERSION}"/kylegospo-gnome-vrr-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/_copr_kylegospo-gnome-vrr.repo
rpm-ostree override replace --experimental --from repo=copr:copr.fedorainfracloud.org:kylegospo:gnome-vrr mutter mutter-common gnome-control-center gnome-control-center-filesystem
rm -f /etc/yum.repos.d/_copr_kylegospo-gnome-vrr.repo
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
gtk4 \
vte291 \
vte-profile \
libadwaita
rpm-ostree install ptyxis
fi
# 40 gets only Ptyxis
if [ ${FEDORA_MAJOR_VERSION} -eq "40" ]; then
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
vte291 \
vte-profile
rpm-ostree install ptyxis
fi
# Add Nerd Fonts
wget https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-"${FEDORA_MAJOR_VERSION}"/che-nerd-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo
20 changes: 20 additions & 0 deletions build_files/base/fetch-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/bash

set -oue pipefail

# Starship Shell Prompt
curl -Lo /tmp/starship.tar.gz "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf /tmp/starship.tar.gz -C /tmp
install -c -m 0755 /tmp/starship /usr/bin
echo 'eval "$(starship init bash)"' >> /etc/bashrc

# Brew Install Script
wget https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -O /usr/libexec/brew-install
chmod +x /usr/libexec/brew-install

# Flatpak Remotes
mkdir -p /usr/etc/flatpak/remotes.d
wget -q https://dl.flathub.org/repo/flathub.flatpakrepo -P /usr/etc/flatpak/remotes.d

# Topgrade Install
pip install --prefix=/usr topgrade
File renamed without changes.
5 changes: 5 additions & 0 deletions build_files/base/font-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/bash

set -ouex pipefail
fc-cache -f /usr/share/fonts/ubuntu
fc-cache -f /usr/share/fonts/inter
2 changes: 2 additions & 0 deletions install-akmods.sh → build_files/base/install-akmods.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -oue pipefail

sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
wget https://negativo17.org/repos/fedora-multimedia.repo -O /etc/yum.repos.d/negativo17-fedora-multimedia.repo
if [[ "${FEDORA_MAJOR_VERSION}" -ge "39" ]]; then
Expand Down
7 changes: 7 additions & 0 deletions build_files/base/install-tmp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/bash

set -ouex pipefail

find /tmp/just -iname '*.just' -exec printf "\n\n" \; -exec cat {} \; >> /usr/share/ublue-os/just/60-custom.just

cp /tmp/ublue-update.toml /usr/etc/ublue-update/ublue-update.toml
16 changes: 16 additions & 0 deletions build_files/base/nvidia-explicit-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/bash

# Install Explicit Sync Patches on Nvidia builds
if [[ "${IMAGE_FLAVOR}" =~ "nvidia" && "${IMAGE_FLAVOR}" =~ "39" ]]; then
wget https://copr.fedorainfracloud.org/coprs/gloriouseggroll/nvidia-explicit-sync/repo/fedora-$(rpm -E %fedora)/gloriouseggroll-nvidia-explicit-sync-fedora-$(rpm -E %fedora).repo?arch=x86_64 -O /etc/yum.repos.d/_copr_gloriouseggroll-nvidia-explicit-sync.repo
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:gloriouseggroll:nvidia-explicit-sync \
xorg-x11-server-Xwayland
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:gloriouseggroll:nvidia-explicit-sync \
egl-wayland \
|| true
rm /etc/yum.repos.d/_copr_gloriouseggroll-nvidia-explicit-sync.repo
fi
Loading
Loading