mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 02:47:56 +01:00
feat: pull back updates from downstream (#14)
This commit is contained in:
parent
72f665c64a
commit
97b27601f6
14 changed files with 463 additions and 182 deletions
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
|
||||
{
|
||||
"name": "Existing Dockerfile",
|
||||
// "build": {
|
||||
// "context": "..",
|
||||
// "dockerfile": "../Dockerfile",
|
||||
// "args": {
|
||||
// "version": "39"
|
||||
// }
|
||||
// },
|
||||
"image": "ghcr.io/jasonn3/build-container-installer:latest",
|
||||
"overrideCommand": true,
|
||||
"shutdownAction": "stopContainer",
|
||||
"privileged": true
|
||||
}
|
||||
2
.github/CODEOWNERS
vendored
Normal file
2
.github/CODEOWNERS
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Default owner of code within this repo
|
||||
* @JasonN3
|
||||
17
.github/release.yml
vendored
Normal file
17
.github/release.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
changelog:
|
||||
exclude:
|
||||
labels:
|
||||
- ignore-for-release
|
||||
categories:
|
||||
- title: "Breaking Changes :boom:"
|
||||
labels:
|
||||
- breaking-change
|
||||
- title: "New Features :sparkles:"
|
||||
labels:
|
||||
- enhancement
|
||||
- title: "Bug Fixes :bug:"
|
||||
labels:
|
||||
- bug
|
||||
- title: Other Changes
|
||||
labels:
|
||||
- "*"
|
||||
104
.github/workflows/build-and-test.yml
vendored
Normal file
104
.github/workflows/build-and-test.yml
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
name: Create and publish an ISO
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
# Test Values
|
||||
env:
|
||||
ARCH: 'x86_64'
|
||||
IMAGE_NAME: 'base'
|
||||
IMAGE_REPO: 'quay.io/fedora-ostree-desktops'
|
||||
VERSION: '39'
|
||||
VARIANT: 'Server'
|
||||
|
||||
jobs:
|
||||
build-container:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Buildah Build
|
||||
id: build-image
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
containerfiles: Containerfile
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
||||
- name: Push image
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
with:
|
||||
image: ${{ steps.build-image.outputs.image }}
|
||||
tags: ${{ steps.build-image.outputs.tags }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
|
||||
build-and-push-iso:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-container
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Lowercase Registry
|
||||
id: registry_case
|
||||
uses: ASzc/change-string-case-action@v6
|
||||
with:
|
||||
string: ${{ env.IMAGE_REPO }}
|
||||
|
||||
- name: Get image version
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
|
||||
- name: Build ISO
|
||||
uses: ./
|
||||
with:
|
||||
arch: ${{ env.ARCH}}
|
||||
image_name: ${{ env.IMAGE_NAME}}
|
||||
image_repo: ${{ env.IMAGE_REPO}}
|
||||
version: ${{ env.VERSION }}
|
||||
variant: ${{ env.VARIANT }}
|
||||
action_version: ${{ steps.meta.outputs.tags }}
|
||||
|
||||
- name: Rename ISO
|
||||
run: |
|
||||
mv build/deploy.iso build/${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso
|
||||
|
||||
- name: Upload ISO as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso
|
||||
path: build/*.iso
|
||||
if-no-files-found: error
|
||||
retention-days: 0
|
||||
compression-level: 0
|
||||
overwrite: true
|
||||
112
.github/workflows/iso.yml
vendored
112
.github/workflows/iso.yml
vendored
|
|
@ -1,112 +0,0 @@
|
|||
name: Create and publish an ISO
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
workflow_call:
|
||||
inputs:
|
||||
IMAGE_VERSION:
|
||||
required: true
|
||||
type: string
|
||||
IMAGE_ARCH:
|
||||
required: true
|
||||
type: string
|
||||
IMAGE_NAME:
|
||||
required: true
|
||||
type: string
|
||||
IMAGE_REPO:
|
||||
required: true
|
||||
type: string
|
||||
VARIANT:
|
||||
required: true
|
||||
type: string
|
||||
BUILD_REPO:
|
||||
required: false
|
||||
type: string
|
||||
default: JasonN3/container-installer
|
||||
BUILD_REF:
|
||||
required: false
|
||||
type: string
|
||||
default: main
|
||||
|
||||
env:
|
||||
IMAGE_VERSION: ${{ inputs.IMAGE_VERSION || '39' }}
|
||||
IMAGE_ARCH: ${{ inputs.IMAGE_ARCH || 'x86_64' }}
|
||||
IMAGE_NAME: ${{ inputs.IMAGE_NAME || 'base-main' }}
|
||||
IMAGE_REPO: ${{ inputs.IMAGE_REPO || 'ghcr.io/ublue-os' }}
|
||||
VARIANT: ${{ inputs.VARIANT || 'Silverblue' }}
|
||||
CURR_REPO: ${{ inputs.BUILD_REPO || github.repository }}
|
||||
CURR_REF: ${{ inputs.BUILD_REF || github.ref }}
|
||||
|
||||
jobs:
|
||||
build-and-push-iso:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:39
|
||||
options: "--privileged"
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Install make and git
|
||||
run: dnf install -y make git
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ env.CURR_REPO }}
|
||||
ref: ${{ env.CURR_REF }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: make install-deps
|
||||
|
||||
- name: Lowercase Registry
|
||||
id: registry_case
|
||||
uses: ASzc/change-string-case-action@v6
|
||||
with:
|
||||
string: ${{ env.IMAGE_REPO }}
|
||||
|
||||
- name: Download image
|
||||
run: |
|
||||
make container/${IMAGE_NAME}-${IMAGE_VERSION} \
|
||||
arch=${IMAGE_ARCH} \
|
||||
version=${IMAGE_VERSION} \
|
||||
image_repo=${{ steps.registry_case.outputs.lowercase }} \
|
||||
image_name=${IMAGE_NAME} \
|
||||
variant=${VARIANT}
|
||||
|
||||
- name: Create boot.iso
|
||||
run: |
|
||||
make boot.iso \
|
||||
arch=${IMAGE_ARCH} \
|
||||
version=${IMAGE_VERSION} \
|
||||
image_repo=${{ steps.registry_case.outputs.lowercase }} \
|
||||
image_name=${IMAGE_NAME} \
|
||||
variant=${VARIANT}
|
||||
|
||||
- name: Create deploy.iso
|
||||
run: |
|
||||
make ${IMAGE_NAME}-${IMAGE_VERSION}.iso \
|
||||
arch=${IMAGE_ARCH} \
|
||||
version=${IMAGE_VERSION} \
|
||||
image_repo=${{ steps.registry_case.outputs.lowercase }} \
|
||||
image_name=${IMAGE_NAME} \
|
||||
variant=${VARIANT}
|
||||
mkdir end_iso
|
||||
mv ${IMAGE_NAME}-${IMAGE_VERSION}.iso end_iso/
|
||||
|
||||
- name: Upload ISO as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}.iso
|
||||
path: end_iso/*.iso
|
||||
if-no-files-found: error
|
||||
retention-days: 0
|
||||
compression-level: 0
|
||||
overwrite: true
|
||||
34
.github/workflows/release.yml
vendored
Normal file
34
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create Draft Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: "Release ${{ github.ref_name }}"
|
||||
draft: true
|
||||
prerelease: false
|
||||
|
||||
#- uses: actions/upload-release-asset@v1.0.1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# with:
|
||||
# upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
# asset_path: ./my-artifact.zip
|
||||
# asset_name: my-artifact.zip
|
||||
# asset_content_type: application/zip
|
||||
|
||||
- uses: eregon/publish-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
release_id: ${{ steps.create_release.outputs.id }}
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/debugdata
|
||||
/container
|
||||
/build
|
||||
/pkglists
|
||||
/results
|
||||
/lorax_templates/*.tmpl
|
||||
|
|
@ -8,5 +8,5 @@
|
|||
/original-pkgsizes.txt
|
||||
/final-pkgsizes.txt
|
||||
/lorax.conf
|
||||
/*.iso
|
||||
/output
|
||||
/*.log
|
||||
25
Containerfile
Normal file
25
Containerfile
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
FROM fedora:39
|
||||
|
||||
ARG VERSION=39
|
||||
|
||||
ENV ARCH="x86_64"
|
||||
ENV IMAGE_NAME="base"
|
||||
ENV IMAGE_REPO="quay.io/fedora-ostree-desktops"
|
||||
ENV IMAGE_TAG="${VERSION}"
|
||||
ENV VARIANT="Server"
|
||||
ENV VERSION="${VERSION}"
|
||||
ENV WEB_UI="false"
|
||||
|
||||
RUN mkdir /build-container-installer
|
||||
COPY /lorax_templates /build-container-installer/lorax_templates
|
||||
COPY /xorriso /build-container-installer/xorriso
|
||||
COPY /Makefile /build-container-installer
|
||||
COPY /entrypoint.sh /
|
||||
|
||||
WORKDIR /build-container-installer
|
||||
|
||||
RUN dnf install -y make && make install-deps
|
||||
|
||||
VOLUME /build-container-installer/build
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
149
Makefile
149
Makefile
|
|
@ -1,78 +1,105 @@
|
|||
arch = x86_64
|
||||
version = 39
|
||||
base_dir = $(shell pwd)
|
||||
image_repo = ghcr.io/ublue-os
|
||||
image_name = base-main
|
||||
variant = Silverblue
|
||||
# Configuration vars
|
||||
## Formatting = UPPERCASE
|
||||
ARCH = x86_64
|
||||
VERSION = 39
|
||||
IMAGE_REPO = quay.io/fedora-ostree-desktops
|
||||
IMAGE_NAME = base
|
||||
IMAGE_TAG = $(VERSION)
|
||||
VARIANT = Server
|
||||
WEB_UI = false
|
||||
REPOS = /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo
|
||||
ADDITIONAL_TEMPLATES = ""
|
||||
|
||||
image_repo_escaped = $(subst /,\/,$(image_repo))
|
||||
image_repo_double_escaped = $(subst \,\\\,$(image_repo_escaped))
|
||||
# Generated vars
|
||||
## Formatting = _UPPERCASE
|
||||
_BASE_DIR = $(shell pwd)
|
||||
_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO))
|
||||
_IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
||||
_VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
|
||||
_REPO_FILES = $(notdir $(REPOS))
|
||||
|
||||
ifeq ($(variant),'Server')
|
||||
lorax_args = --macboot --noupgrade
|
||||
ifeq ($(VARIANT),'Server')
|
||||
_LORAX_ARGS = --macboot --noupgrade
|
||||
else
|
||||
lorax_args = --nomacboot
|
||||
_LORAX_ARGS = --nomacboot
|
||||
endif
|
||||
|
||||
$(image_name)-$(version).iso: boot.iso container/$(image_name)-$(version) xorriso/input.txt
|
||||
xorriso -dialog on < $(base_dir)/xorriso/input.txt
|
||||
|
||||
boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl
|
||||
rm -Rf $(base_dir)/results
|
||||
lorax -p $(image_name) -v $(version) -r $(version) -t $(variant) \
|
||||
--isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(version) \
|
||||
$(lorax_args) \
|
||||
--repo /etc/yum.repos.d/fedora.repo \
|
||||
--repo /etc/yum.repos.d/fedora-updates.repo \
|
||||
--add-template $(base_dir)/lorax_templates/set_installer.tmpl \
|
||||
--add-template $(base_dir)/lorax_templates/configure_upgrades.tmpl \
|
||||
$(base_dir)/results/
|
||||
mv $(base_dir)/results/images/boot.iso $(base_dir)/
|
||||
|
||||
container/$(image_name)-$(version):
|
||||
mkdir container
|
||||
podman pull $(image_repo)/$(image_name):$(version)
|
||||
podman save --format oci-dir -o $(base_dir)/container/$(image_name)-$(version) $(image_repo)/$(image_name):$(version)
|
||||
podman rmi $(image_repo)/$(image_name):$(version)
|
||||
|
||||
install-deps:
|
||||
dnf install -y lorax xorriso podman git rpm-ostree
|
||||
|
||||
ifeq ($(WEB_UI),true)
|
||||
_LORAX_ARGS += -i anaconda-webui
|
||||
endif
|
||||
|
||||
# Step 7: Buid end ISO
|
||||
## Default action
|
||||
build/deploy.iso: boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.txt
|
||||
mkdir $(_BASE_DIR)/build || true
|
||||
xorriso -dialog on < $(_BASE_DIR)/xorriso/input.txt
|
||||
|
||||
# Step 1: Generate Lorax Templates
|
||||
lorax_templates/%.tmpl: lorax_templates/%.tmpl.in
|
||||
sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/lorax_templates/$*.tmpl.in > $(base_dir)/lorax_templates/$*.tmpl
|
||||
sed 's/@IMAGE_REPO@/$(image_repo_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,}
|
||||
sed 's/@VERSION@/$(version)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,}
|
||||
sed 's/@IMAGE_REPO_ESCAPED@/$(image_repo_double_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,}
|
||||
sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_BASE_DIR)/lorax_templates/$*.tmpl.in > $(_BASE_DIR)/lorax_templates/$*.tmpl
|
||||
|
||||
sed 's/@IMAGE_TAG@/$(IMAGE_TAG)/' $(_BASE_DIR)/lorax_templates/$*.tmpl > $(_BASE_DIR)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(_BASE_DIR)/lorax_templates/$*.tmpl{.tmp,}
|
||||
|
||||
sed 's/@IMAGE_REPO_ESCAPED@/$(_IMAGE_REPO_DOUBLE_ESCAPED)/' $(_BASE_DIR)/lorax_templates/$*.tmpl > $(_BASE_DIR)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(_BASE_DIR)/lorax_templates/$*.tmpl{.tmp,}
|
||||
|
||||
# Step 2: Replace vars in repo files
|
||||
%.repo: /etc/yum.repos.d/%.repo
|
||||
cp /etc/yum.repos.d/$*.repo $(_BASE_DIR)/$*.repo
|
||||
sed -i "s/\$$releasever/${VERSION}/g" $(_BASE_DIR)/$*.repo
|
||||
sed -i "s/\$$basearch/${ARCH}/g" $(_BASE_DIR)/$*.repo
|
||||
|
||||
xorriso/input.txt: xorriso/gen_input.sh
|
||||
bash $(base_dir)/xorriso/gen_input.sh | tee $(base_dir)/xorriso/input.txt
|
||||
# Step 3: Build boot.iso using Lorax
|
||||
boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl $(_REPO_FILES)
|
||||
rm -Rf $(_BASE_DIR)/results
|
||||
lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \
|
||||
--isfinal --buildarch=$(ARCH) --volid=$(_VOLID) \
|
||||
$(_LORAX_ARGS) \
|
||||
$(foreach file,$(_REPO_FILES),--repo $(_BASE_DIR)/$(file)) \
|
||||
--add-template $(_BASE_DIR)/lorax_templates/set_installer.tmpl \
|
||||
--add-template $(_BASE_DIR)/lorax_templates/configure_upgrades.tmpl \
|
||||
$(foreach file,$(ADDITIONAL_TEMPLATES),--add-template $(file)) \
|
||||
$(_BASE_DIR)/results/
|
||||
mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/
|
||||
|
||||
# Step 4: Download container image
|
||||
container/$(IMAGE_NAME)-$(IMAGE_TAG):
|
||||
mkdir container || true
|
||||
podman pull $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||
podman save --format oci-dir -o $(_BASE_DIR)/container/$(IMAGE_NAME)-$(IMAGE_TAG) $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||
podman rmi $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||
|
||||
# Step 5: Generate xorriso script
|
||||
xorriso/%.sh: xorriso/%.sh.in
|
||||
sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/xorriso/$*.sh.in > $(base_dir)/xorriso/$*.sh
|
||||
sed 's/@VERSION@/$(version)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp
|
||||
mv $(base_dir)/xorriso/$*.sh{.tmp,}
|
||||
sed 's/@ARCH@/$(arch)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp
|
||||
mv $(base_dir)/xorriso/$*.sh{.tmp,}
|
||||
sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_BASE_DIR)/xorriso/$*.sh.in > $(_BASE_DIR)/xorriso/$*.sh
|
||||
|
||||
sed 's/@IMAGE_TAG@/$(IMAGE_TAG)/' $(_BASE_DIR)/xorriso/$*.sh > $(_BASE_DIR)/xorriso/$*.sh.tmp
|
||||
mv $(_BASE_DIR)/xorriso/$*.sh{.tmp,}
|
||||
|
||||
sed 's/@ARCH@/$(ARCH)/' $(_BASE_DIR)/xorriso/$*.sh > $(_BASE_DIR)/xorriso/$*.sh.tmp
|
||||
mv $(_BASE_DIR)/xorriso/$*.sh{.tmp,}
|
||||
|
||||
# Step 6: Generate xorriso input
|
||||
xorriso/input.txt: xorriso/gen_input.sh
|
||||
bash $(_BASE_DIR)/xorriso/gen_input.sh | tee $(_BASE_DIR)/xorriso/input.txt
|
||||
|
||||
|
||||
clean:
|
||||
rm -Rf $(base_dir)/container || true
|
||||
rm -Rf $(base_dir)/debugdata || true
|
||||
rm -Rf $(base_dir)/pkglists || true
|
||||
rm -Rf $(base_dir)/results || true
|
||||
rm -f $(base_dir)/lorax_templates/*.tmpl || true
|
||||
rm -f $(base_dir)/xorriso/input.txt || true
|
||||
rm -f $(base_dir)/xorriso/*.sh || true
|
||||
rm -f $(base_dir)/{original,final}-pkgsizes.txt || true
|
||||
rm -f $(base_dir)/lorax.conf || true
|
||||
rm -f $(base_dir)/*.iso || true
|
||||
rm -f $(base_dir)/*.log || true
|
||||
|
||||
rm -Rf $(_BASE_DIR)/container || true
|
||||
rm -Rf $(_BASE_DIR)/debugdata || true
|
||||
rm -Rf $(_BASE_DIR)/pkglists || true
|
||||
rm -Rf $(_BASE_DIR)/results || true
|
||||
rm -Rf $(_BASE_DIR)/build || true
|
||||
rm -f $(_BASE_DIR)/lorax_templates/*.tmpl || true
|
||||
rm -f $(_BASE_DIR)/xorriso/input.txt || true
|
||||
rm -f $(_BASE_DIR)/xorriso/*.sh || true
|
||||
rm -f $(_BASE_DIR)/{original,final}-pkgsizes.txt || true
|
||||
rm -f $(_BASE_DIR)/lorax.conf || true
|
||||
rm -f $(_BASE_DIR)/*.iso || true
|
||||
rm -f $(_BASE_DIR)/*.log || true
|
||||
|
||||
install-deps:
|
||||
dnf install -y lorax xorriso podman
|
||||
|
||||
.PHONY: clean install-deps
|
||||
91
README.md
91
README.md
|
|
@ -1,2 +1,89 @@
|
|||
# container-installer
|
||||
Creates an ISO for installing a container image as an OS
|
||||

|
||||
|
||||
# Bulid Container Installer Action
|
||||
This action is used to generate an ISO for installing OSTrees stored in a container. This utilizes the anaconda command `ostreecontainer`
|
||||
|
||||
## Makefile
|
||||
A Makefile is provided for ease of use. There are separate targets for each file generated, however `make` can be used to generate the final image and `make clean` can be used to clean up the workspace. The resulting ISO will be stored in the `build` directory.
|
||||
|
||||
See [Customizing](#customizing) for information about customizing the image that gets created.
|
||||
|
||||
## Container
|
||||
A container with the necessary tools already installed is provided at `ghcr.io/jasonn3/build-container-installer:latest`
|
||||
|
||||
To use the container file, run `docker run --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest`.
|
||||
|
||||
This will create an ISO with the baked in defaults of the container image.
|
||||
|
||||
See [Customizing](#customizing) for information about customizing the image that gets created. The variable can either be defined as environment variables or as command arguments.
|
||||
Examples:
|
||||
|
||||
Building an ISO to install Fedora 38
|
||||
```bash
|
||||
docker run --rm --privileged --volume .:/build-container-installer/build -e VERSION=38 -e IMAGE_NAME=base -e IMAGE_TAG=38 -e VARIANT=Server ghcr.io/jasonn3/build-container-installer:latest
|
||||
```
|
||||
|
||||
Building an ISO to install Fedora 39
|
||||
```bash
|
||||
docker run --rm --privileged --volume .:/build-container-installer/build -e VERSION=39 -e IMAGE_NAME=base -e IMAGE_TAG=39 -e VARIANT=Server ghcr.io/jasonn3/build-container-installer:latest
|
||||
```
|
||||
|
||||
## Customizing
|
||||
The following variables can be used to customize the create image.
|
||||
|
||||
| Variable | Description | Default Value |
|
||||
| ----------------- | -------------------------------------------------------- | ------------------------------ |
|
||||
| ARCH | Architecture for image to build | x86_64 |
|
||||
| VERSION | Fedora version of installer to build | 39 |
|
||||
| IMAGE_REPO | Repository containing the source container image | quay.io/fedora-ostree-desktops |
|
||||
| IMAGE_NAME | Name of the source container image | base |
|
||||
| IMAGE_TAG | Tag of the source container image | *VERSION* |
|
||||
| EXTRA_BOOT_PARAMS | Extra params used by grub to boot the anaconda installer | \[empty\] |
|
||||
| VARIANT | Source container variant\* | Server |
|
||||
| WEB_UI | Enable Anaconda WebUI (experimental) | false |
|
||||
|
||||
Available options for VARIANT can be found by running `dnf provides system-release`.
|
||||
Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinoite
|
||||
|
||||
## VSCode Dev Container
|
||||
There is a dev container configuration provided for development. By default it will use the existing container image available at `ghcr.io/jasonn3/build-container-installer:latest`, however, you can have it build a new image by editing `.devcontainer/devcontainer.json` and replacing `image` with `build`. `Ctrl+/` can be used to comment and uncomment blocks of code within VSCode.
|
||||
|
||||
The code from VSCode will be available at `/workspaces/build-container-installer` once the container has started.
|
||||
|
||||
Privileged is required for access to loop devices for lorax.
|
||||
|
||||
Use existing image
|
||||
```json
|
||||
{
|
||||
"name": "Existing Dockerfile",
|
||||
// "build": {
|
||||
// "context": "..",
|
||||
// "dockerfile": "../Dockerfile",
|
||||
// "args": {
|
||||
// "version": "39"
|
||||
// }
|
||||
// },
|
||||
"image": "ghcr.io/jasonn3/build-container-installer:latest",
|
||||
"overrideCommand": true,
|
||||
"shutdownAction": "stopContainer",
|
||||
"privileged": true
|
||||
}
|
||||
```
|
||||
|
||||
Build a new image
|
||||
```json
|
||||
{
|
||||
"name": "Existing Dockerfile",
|
||||
"build": {
|
||||
"context": "..",
|
||||
"dockerfile": "../Dockerfile",
|
||||
"args": {
|
||||
"version": "39"
|
||||
}
|
||||
},
|
||||
//"image": "ghcr.io/jasonn3/build-container-installer:latest",
|
||||
"overrideCommand": true,
|
||||
"shutdownAction": "stopContainer",
|
||||
"privileged": true
|
||||
}
|
||||
```
|
||||
54
action.yml
Normal file
54
action.yml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
name: Build Contianer Installer
|
||||
description: generate an ISO for installing OSTrees stored in a container
|
||||
|
||||
inputs:
|
||||
arch:
|
||||
description: Architecture for image to build
|
||||
required: true
|
||||
default: x86_64
|
||||
image_name:
|
||||
description: Name of the source container image
|
||||
required: true
|
||||
default: base
|
||||
image_repo:
|
||||
description: Repository containing the source container image
|
||||
required: true
|
||||
default: quay.io/fedora-ostree-desktops
|
||||
variant:
|
||||
description: "Source container variant. Available options can be found by running `dnf provides system-release`. Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinonite"
|
||||
required: true
|
||||
default: Server
|
||||
version:
|
||||
description: Fedora version of installer to build
|
||||
required: true
|
||||
default: "39"
|
||||
image_tag:
|
||||
description: Tag of the source container image. Defaults to the installer version
|
||||
required: false
|
||||
web_ui:
|
||||
description: Enable Anaconda WebUI
|
||||
required: false
|
||||
default: "false"
|
||||
action_version:
|
||||
description: Version of the action container to run
|
||||
required: true
|
||||
default: "latest"
|
||||
additional_templates:
|
||||
description: Space delimetered list of additional Lorax templates to include
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run docker image
|
||||
shell: bash
|
||||
run: |
|
||||
docker run --privileged --volume .:/github/workspace/ ghcr.io/jasonn3/build-container-installer:${{ inputs.action_version }} \
|
||||
ARCH=${{ inputs.arch }} \
|
||||
IMAGE_NAME=${{ inputs.image_name }} \
|
||||
IMAGE_REPO=${{ inputs.image_repo }} \
|
||||
VARIANT=${{ inputs.variant }} \
|
||||
VERSION=${{ inputs.version }} \
|
||||
IMAGE_TAG=${{ inputs.image_tag || inputs.version }} \
|
||||
WEB_UI=${{ inputs.web_ui }} \
|
||||
"ADDITIONAL_TEMPLATES=${{ inputs.additional_templates }}"
|
||||
24
entrypoint.sh
Normal file
24
entrypoint.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
for entry in $@
|
||||
do
|
||||
export $entry
|
||||
done
|
||||
|
||||
# Pull container
|
||||
make container/${IMAGE_NAME}-${IMAGE_TAG} $@
|
||||
|
||||
# Build base ISO
|
||||
make boot.iso $@
|
||||
|
||||
# Add container to ISO
|
||||
make build/deploy.iso $@
|
||||
|
||||
# Make output dir in github workspace
|
||||
mkdir /github/workspace/build || true
|
||||
|
||||
# Copy resulting iso to github workspace and fix permissions
|
||||
cp build/deploy.iso /github/workspace/build
|
||||
chmod -R ugo=rwX /github/workspace/build
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
append usr/share/anaconda/interactive-defaults.ks "%post --erroronfail"
|
||||
append usr/share/anaconda/interactive-defaults.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@VERSION@/' /ostree/deploy/default/deploy/*.origin"
|
||||
append usr/share/anaconda/interactive-defaults.ks "%end"
|
||||
append usr/share/anaconda/interactive-defaults.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@IMAGE_TAG@/' /ostree/deploy/default/deploy/*.origin"
|
||||
append usr/share/anaconda/interactive-defaults.ks "%end"
|
||||
|
||||
append usr/share/anaconda/post-scripts/configure_upgrades.ks "%post --erroronfail"
|
||||
append usr/share/anaconda/post-scripts/configure_upgrades.ks "sed -i 's/container-image-reference=.*/container-image-reference=ostree-image-signed:docker:\/\/@IMAGE_REPO_ESCAPED@\/@IMAGE_NAME@:@IMAGE_TAG@/' /ostree/deploy/default/deploy/*.origin"
|
||||
append usr/share/anaconda/post-scripts/configure_upgrades.ks "%end"
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "-indev $(pwd)/boot.iso"
|
||||
echo "-outdev $(pwd)/@IMAGE_NAME@-@VERSION@.iso"
|
||||
echo "-outdev $(pwd)/build/deploy.iso"
|
||||
echo "-boot_image any replay"
|
||||
echo "-volid @IMAGE_NAME@-@ARCH@-@VERSION@"
|
||||
echo "-joliet on"
|
||||
echo "-compliance joliet_long_names"
|
||||
cd container
|
||||
for file in $(find @IMAGE_NAME@-@VERSION@)
|
||||
for file in $(find @IMAGE_NAME@-@IMAGE_TAG@)
|
||||
do
|
||||
echo "-map $(pwd)/${file} ${file}"
|
||||
echo "-chmod 0444 ${file}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue