Skip to content

Commit 0f21dbc

Browse files
committed
Initial creation with proper signing setup
1 parent 751b3a8 commit 0f21dbc

7 files changed

Lines changed: 92 additions & 39 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
schedule:
8-
- cron: '05 10 * * *' # 10:05am UTC everyday
8+
- cron: '12 06 * * *' # 06:12am UTC everyday
99
push:
1010
branches:
1111
- main
@@ -14,7 +14,7 @@ on:
1414
workflow_dispatch:
1515

1616
env:
17-
IMAGE_DESC: "My Customized Universal Blue Image"
17+
IMAGE_DESC: "Universal Blue Image for MSI EVO 13"
1818
IMAGE_KEYWORDS: "bootc,ublue,universal-blue"
1919
IMAGE_LOGO_URL: "https://avatars.githubusercontent.com/u/120078124?s=200&v=4" # Put your own image here for a fancy profile on https://artifacthub.io/!
2020
IMAGE_NAME: "${{ github.event.repository.name }}" # output image name, usually same as repo name

Containerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Allow build scripts to be referenced without being copied into the final image
22
FROM scratch AS ctx
3-
COPY build_files /
3+
# Modified: It's idiotic to not include all the files in the build context
4+
COPY / /
45

56
# Base Image
6-
FROM ghcr.io/ublue-os/bazzite:stable
7+
FROM ghcr.io/ublue-os/aurora-dx:stable-daily
78

89
## Other possible base images include:
910
# FROM ghcr.io/ublue-os/bazzite:latest
@@ -22,7 +23,7 @@ RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
2223
--mount=type=cache,dst=/var/cache \
2324
--mount=type=cache,dst=/var/log \
2425
--mount=type=tmpfs,dst=/tmp \
25-
/ctx/build.sh && \
26+
/ctx/build_files/build.sh && \
2627
ostree container commit
2728

2829
### LINTING

README.md

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,15 @@
22

33
# Purpose
44

5-
This repository is meant to be a template for building your own custom [bootc](https://github.com/bootc-dev/bootc) image. This template is the recommended way to make customizations to any image published by the Universal Blue Project:
6-
- Products: [Aurora](https://getaurora.dev/), [Bazzite](https://bazzite.gg/), [Bluefin](https://projectbluefin.io/), [uCore](https://projectucore.io/)
7-
- Base images: [main](https://github.com/ublue-os/main/) - the product images build on these and may be a better starting point depending on what you want.
5+
Files and GitHub Actions for generating an Ostree bootc image derived from a Universal Blue OS image.
86

9-
or any other base image if you want to start from scratch:
10-
11-
- Fedora: `quay.io/fedora/fedora-bootc:41`
12-
- CentOS Stream 10: `quay.io/centos-bootc/centos-bootc:stream10`
13-
14-
This template includes a Containerfile and a Github workflow for building the container image, signing, and proper metadata to be listed on [artifacthub](https://artifacthub.io/). As soon as the workflow is enabled in your repository, it will build the container image and push it to the Github Container Registry.
15-
16-
# Prerequisites
17-
18-
Working knowledge in the following topics:
19-
20-
- Containers
21-
- https://www.youtube.com/watch?v=SnSH8Ht3MIc
22-
- https://www.mankier.com/5/Containerfile
23-
- bootc
24-
- https://bootc-dev.github.io/bootc/
25-
- Fedora Silverblue (and other Fedora Atomic variants)
26-
- https://docs.fedoraproject.org/en-US/fedora-silverblue/
27-
- Github Workflows
28-
- https://docs.github.com/en/actions/using-workflows
29-
30-
# Video Tutorial
31-
32-
TesterTech has made a tutorial video, check it out:
33-
34-
[![Video Tutorial](https://img.youtube.com/vi/IxBl11Zmq5w/0.jpg)](https://www.youtube.com/watch?v=IxBl11Zmq5wE)
7+
As of Fedora 42, it's no longer possible to perform hot-fix changes to the rootfs, which limits certain workarounds, and this is the only alternative.
358

369
# How to Use
3710

38-
## Template
11+
## build.sh
3912

40-
Select `Use this Template` and create a new repository from it. To enable the workflows, you may need to go the `Actions` tab of the new repository and click to enable workflows.
13+
Called by the `Containerfile` to do the actual work.
4114

4215
## Containerfile
4316

build_files/build.sh

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,34 @@
22

33
set -ouex pipefail
44

5+
# recursively copy everything from system_config/ in the build context to the root of the repo.
6+
rsync -rvK /ctx/system_config /
7+
58
### Install packages
69

710
# Packages can be installed from any enabled yum repo on the image.
811
# RPMfusion repos are available by default in ublue main images
912
# List of rpmfusion packages can be found here:
1013
# https://mirrors.rpmfusion.org/mirrorlist?path=free/fedora/updates/39/x86_64/repoview/index.html&protocol=https&redirect=1
1114

12-
# this installs a package from fedora repos
13-
dnf5 install -y tmux
15+
# Install KDE extras
16+
dnf5 install -y \
17+
imsettings-plasma \
18+
kclock-plasma-applet \
19+
marble-plasma \
20+
plasma-discover-offline-updates \
21+
plasma-discover-rpm-ostree \
22+
plasma-discover-snap
23+
24+
# Need java for the cloudflare-warp to work
25+
dnf5 install -y \
26+
java-11-openjdk \
27+
cloudflare-warp
1428

29+
# tio for serial
30+
dnf5 install -y \
31+
tio
32+
1533
# Use a COPR Example:
1634
#
1735
# dnf5 -y copr enable ublue-os/staging
@@ -21,4 +39,11 @@ dnf5 install -y tmux
2139

2240
#### Example for enabling a System Unit File
2341

24-
systemctl enable podman.socket
42+
#systemctl enable podman.socket
43+
44+
# Add the nix mountpoint
45+
install -d -m 0755 /nix
46+
47+
48+
# Adds the cosign.pub as the signing key for verifying bootc images pulled from this repo.
49+
/ctx/build_files/signing.sh

build_files/signing.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/bash
2+
#
3+
# Based on https://github.com/bsherman/bos/blob/main/signing.sh
4+
#
5+
# Sets up the system container registry config in the image to use the cosign.pub
6+
# key from the root of the repo/build context as the signature verification key
7+
# of any images pulled from the GitHub docker registry for this repo.
8+
9+
set -exou pipefail
10+
11+
# these need to match your GitHub username and the name of this repo
12+
readonly github_username="mtalexan"
13+
readonly github_reponame="ublueos-msi-evo13"
14+
15+
# Signing
16+
mkdir -p /etc/containers
17+
mkdir -p /etc/pki/containers
18+
mkdir -p /etc/containers/registries.d/
19+
20+
if [ -f /usr/etc/containers/policy.json ]; then
21+
cp /usr/etc/containers/policy.json /etc/containers/policy.json
22+
fi
23+
24+
cat <<<"$(jq '.transports.docker |=. + {
25+
"ghcr.io/${github_username}/${github_reponame}": [
26+
{
27+
"type": "sigstoreSigned",
28+
"keyPath": "/etc/pki/containers/${github_username}-${github_reponame}.pub",
29+
"signedIdentity": {
30+
"type": "matchRepository"
31+
}
32+
}
33+
]}' <"/etc/containers/policy.json")" >"/tmp/policy.json"
34+
cp /tmp/policy.json /etc/containers/policy.json
35+
cp /ctx/cosign.pub /etc/pki/containers/${github_username}-${github_reponame}.pub
36+
tee /etc/containers/registries.d/${github_username}-${github_reponame}.yaml <<EOF
37+
docker:
38+
ghcr.io/${github_username}/${github_reponame}:
39+
use-sigstore-attachments: true
40+
EOF
41+
42+
mkdir -p /usr/etc/containers/
43+
cp /etc/containers/policy.json /usr/etc/containers/policy.json

cosign.pub

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbM1TZ7myGjXpTpcLTY9h0IqbcNPj
3+
a/26+7idLw68isANmtvijsDyvr7NcClthexlXB7Usz5WRHZ/iv3llR0aBw==
4+
-----END PUBLIC KEY-----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[cloudflare-warp-stable]
2+
name=cloudflare-warp-stable
3+
baseurl=https://pkg.cloudflareclient.com/rpm
4+
enabled=1
5+
type=rpm
6+
gpgcheck=1
7+
gpgkey=https://pkg.cloudflareclient.com/pubkey.gpg

0 commit comments

Comments
 (0)