Skip to content

Commit

Permalink
Restructure for presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Jan 20, 2025
1 parent 480df9c commit fa9aa77
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 33 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-container-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build container
run-name: building container
on:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run podman build - base
run: |
podman build -t ghcr.io/gbraad-redhat/fedora-bootc-example/fedora:latest \
--build-arg=BASE_IMAGE="quay.io/fedora/fedora" \
-f containers/Containerfile .
- name: Push image to ghcr.io - base
run: |
podman push --creds=${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} \
ghcr.io/gbraad-redhat/fedora-bootc-example/fedora:latest
24 changes: 24 additions & 0 deletions .github/workflows/build-container-bootc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build container (bootc)
run-name: building container (bootc)
on:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run podman build - base
run: |
podman build -t ghcr.io/gbraad-redhat/fedora-bootc-example/fedora-bootc:latest \
--build-arg=BASE_IMAGE="quay.io/fedora/fedora-bootc" \
-f containers/Containerfile .
- name: Push image to ghcr.io - base
run: |
podman push --creds=${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} \
ghcr.io/gbraad-redhat/fedora-bootc-example/fedora-bootc:latest
19 changes: 0 additions & 19 deletions .github/workflows/build-container.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: build qcow2 from bootc image
name: build disk image (release)
run-name: build disk image (release)
on:
workflow_dispatch:

env:
IMAGE_NAME: ghcr.io/gbraad-devenv/fedora-bootc:latest
IMAGE_NAME: ghcr.io/gbraad-redhat/fedora-bootc-example/fedora-bootc:latest
DISK_TYPE: qcow2
ROOTFS: xfs
ARCH: amd64
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/build-image-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: build disk image (upload)
run-name: build disk image (upload)
on:
workflow_dispatch:

env:
IMAGE_NAME: ghcr.io/gbraad-redhat/fedora-bootc-example/fedora-bootc:latest
DISK_TYPE: qcow2
ROOTFS: xfs
ARCH: amd64
BIB_IMAGE: quay.io/centos-bootc/bootc-image-builder:latest
BODY: "Fedora base bootc image"

jobs:
build:
name: Build qcow2 image
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04

steps:
- name: Remove unwanted stuff
uses: gbraad-actions/remove-unwanted@v1

- uses: actions/checkout@v4

- name: Workaround podman issues in GH actions
run: |
# see https://github.com/osbuild/bootc-image-builder/issues/446
sudo rm -rf /var/lib/containers/storage
sudo mkdir -p /etc/containers
echo -e "[storage]\ndriver = \"overlay\"\nrunroot = \"/run/containers/storage\"\ngraphroot = \"/var/lib/containers/storage\"" | sudo tee /etc/containers/storage.conf
- name: Workarounds for GH runner diskspace
run: |
# use custom basetemp here because /var/tmp is on a smaller disk
# than /mnt
sudo mkdir -p /mnt/var/tmp/bib-tests
# on GH runners /mnt has 70G free space, use that for our container
# storage
sudo mkdir -p /mnt/var/lib/containers
sudo mount -o bind /mnt/var/lib/containers /var/lib/containers
sudo mkdir /var/lib/containers/storage
- name: Build image
id: build-image
run: |
mkdir -p ./output
sed -e 's;@@IMAGE@@;${{ env.IMAGE_NAME }};g' config.toml.in > config.toml
sudo podman pull ${{ env.IMAGE_NAME }}
sudo podman run \
--rm \
-it \
--privileged \
--pull=newer \
--security-opt label=type:unconfined_t \
-v ./config.toml:/config.toml:ro \
-v ./output:/output \
-v /var/lib/containers/storage:/var/lib/containers/storage \
${{ env.BIB_IMAGE }} \
--target-arch ${{ env.ARCH }} \
--type ${{ env.DISK_TYPE }} \
--rootfs ${{ env.ROOTFS }} \
--local \
${{ env.IMAGE_NAME }}
- name: Upload image
uses: actions/upload-artifact@v4
with:
name: disk
path: |
./output/qcow2/disk.qcow2
retention-days: 5
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Fedora base (Bootable) Containers
=================================
Fedora (Bootable) Containers example
====================================

Merged into the main Fedora images
https://github.com/gbraad-devenv/fedora
"From `Containerfile` to Virtual Machine"
7 changes: 0 additions & 7 deletions config.toml.in
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
[customizations.installer.kickstart]
contents = """

%post
bootc switch --mutate-in-place --transport registry @@IMAGE@@
%end
"""
3 changes: 2 additions & 1 deletion containers/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ ARG BASE_VERSION="41"

FROM ${BASE_IMAGE}:${BASE_VERSION}

ENTRYPOINT ["/sbin/init"]
RUN useradd -m -d /var/home/admin -G wheel admin \
&& echo "admin:password" | chpasswd

0 comments on commit fa9aa77

Please sign in to comment.