From 20d284c6eef7a1b33fa3864d6c60d19f4c361ec5 Mon Sep 17 00:00:00 2001 From: thislight Date: Mon, 30 Jun 2025 21:17:41 +0800 Subject: [PATCH] add fedora-42 --- .forgejo/workflows/build-fedora-42.yml | 35 +++++++++++++++ fedora-42-minimal/Containerfile | 19 ++++++++ fedora-42-minimal/containers.conf | 2 + fedora-42/Containerfile | 7 +++ shared/fedora/pkgs.ts | 62 ++++++++++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 .forgejo/workflows/build-fedora-42.yml create mode 100644 fedora-42-minimal/Containerfile create mode 100644 fedora-42-minimal/containers.conf create mode 100644 fedora-42/Containerfile create mode 100644 shared/fedora/pkgs.ts diff --git a/.forgejo/workflows/build-fedora-42.yml b/.forgejo/workflows/build-fedora-42.yml new file mode 100644 index 0000000..db20bca --- /dev/null +++ b/.forgejo/workflows/build-fedora-42.yml @@ -0,0 +1,35 @@ +on: + push: + branches: ['master'] + paths: + - "fedora-42/**" + - "fedora-42-minimal/**" + - "shared/**" + - ".forgejo/workflows/build-fedora-42.yml" + schedule: + - cron: "0 0 * * 3" # Every Thursday 00:00 + + +jobs: + build: + runs-on: fedora-41 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version-file: 'package.json' + - name: Fulfill Package Manager Cache + run: dnf makecache -y --releasever 42 + - name: Sign in to Image Index + run: buildah login code.lightstands.xyz --username ${{ env.GITHUB_ACTOR }} --password ${{ secrets.PUBLICATION_TOKEN }} + - name: Build Minimal Images + run: DNF_CACHE_PATH=/var/cache/dnf bun shared/build-image.ts code.lightstands.xyz/standcoded/fedora-minimal:42 fedora-42-minimal arm64 + - name: Push Minimal Images + run: buildah manifest push code.lightstands.xyz/standcoded/fedora-minimal:42 --all + - name: Build Complete Images + run: DNF_CACHE_PATH=/var/cache/dnf bun shared/build-image.ts code.lightstands.xyz/standcoded/fedora:42 fedora-42 arm64 + - name: Push Complete Images + run: buildah manifest push code.lightstands.xyz/standcoded/fedora:42 --all + diff --git a/fedora-42-minimal/Containerfile b/fedora-42-minimal/Containerfile new file mode 100644 index 0000000..605389a --- /dev/null +++ b/fedora-42-minimal/Containerfile @@ -0,0 +1,19 @@ +FROM fedora:42 + +RUN sh /imgbuild/fedora/instpkgs-minimal.sh + +# We don't clean up dnf cache since user may want to install packages for their use + +ADD containers.conf /etc/containers/ + +RUN sh /imgbuild/configure-nested-container.sh + +VOLUME /var/lib/containers +VOLUME /home/action/.local/share/containers + +# Set up environment variables to note that this is +# not starting with usernamespace and default to +# isolate the filesystem with chroot. +ENV _BUILDAH_STARTED_IN_USERNS="" BUILDAH_ISOLATION=chroot + +ENTRYPOINT [ "/bin/bash" ] diff --git a/fedora-42-minimal/containers.conf b/fedora-42-minimal/containers.conf new file mode 100644 index 0000000..0bf45cd --- /dev/null +++ b/fedora-42-minimal/containers.conf @@ -0,0 +1,2 @@ +[engine] +cgroup_manager = "cgroupfs" diff --git a/fedora-42/Containerfile b/fedora-42/Containerfile new file mode 100644 index 0000000..2438a5b --- /dev/null +++ b/fedora-42/Containerfile @@ -0,0 +1,7 @@ +FROM oven/bun:1-distroless as bun + +FROM localhost/runner-images/fedora-minimal:42 + +COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun + +RUN ["/usr/local/bin/bun", "/imgbuild/fedora/pkgs.ts", "install"] diff --git a/shared/fedora/pkgs.ts b/shared/fedora/pkgs.ts new file mode 100644 index 0000000..27b5c7b --- /dev/null +++ b/shared/fedora/pkgs.ts @@ -0,0 +1,62 @@ +#!/usr/bin/env bun + +type SoftwareGroup = { + name: string + packages: string[] +} + +async function install(groups: SoftwareGroup[]) { + const packageNames = groups.flatMap(x => x.packages) + await Bun.$`dnf install -y --setopt install_weak_deps=False ${packageNames}` +} + +const EXT_SOFTWARES: SoftwareGroup[] = [ + { + name: "Python", packages: [ + "python", + "python-devel", + "poetry" + ] + }, + { + name: "NodeJS", packages: [ + "nodejs", "nodejs-devel" + ] + }, + { + name: "Perl", packages: [ + "perl", "perl-devel" + ] + }, + { + name: "Ruby", packages: [ + "ruby", "ruby-devel" + ] + }, + { + name: "PHP", packages: [ + "php", "php-devel", "composer" + ] + }, + { + name: "Java", packages: [ + "java-21-openjdk", "java-21-openjdk-devel", + ] + }, + { + name: "QEMU", packages: [ + "qemu-user-static", "qemu-user-binfmt" + ] + }, + { + name: "C", packages: [ + "bison", "flex", "vcpkg", "@c-development" + ] + } +] + +const command = process.argv[2] + +if (command === "install") { + await install(EXT_SOFTWARES) +}