Skip to content
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
19 changes: 11 additions & 8 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: Container

on: # yamllint disable-line rule:truthy
# push:
# branches: ["main"]
# pull_request:
# branches: ["main"]
# merge_group:
# types: ["checks_requested"]
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
types: ["checks_requested"]

jobs:
build-base:
Expand All @@ -33,7 +34,9 @@ jobs:
uses: docker/metadata-action@v6
id: meta
with:
images: ghcr.io/osbuild/image-builder-cli
images: |
ghcr.io/osbuild/image-builder
ghcr.io/osbuild/image-builder-cli
tags: |
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=latest
Expand All @@ -46,6 +49,6 @@ jobs:
platforms: linux/amd64,linux/arm64
file: ./Containerfile
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
cache-from: type=registry,ref=ghcr.io/osbuild/image-builder-cli:latest
cache-from: type=registry,ref=ghcr.io/osbuild/image-builder:latest
cache-to: type=inline
tags: ${{ steps.meta.outputs.tags }}
51 changes: 32 additions & 19 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
ARG BASE_CONTAINER_IMAGE=registry.fedoraproject.org/fedora:latest
FROM ${BASE_CONTAINER_IMAGE}

# The Fedora 41 container doesn't have python3 installed by default
RUN dnf install -y python3

# Host check test dependencies
RUN dnf install -y kernel kernel-debug
FROM registry.fedoraproject.org/fedora:44 AS builder
RUN dnf install -y git-core golang gpgme-devel libassuan-devel && mkdir -p /build/
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# disable cgo as
# a) gcc crashes on fedora41/arm64 regularly
# b) we don't really need it
# Note that this cannot move into the makefile as for bib we want to build *with* cgo to have
# the chmod/chown logic work as those need cgo/libnss (in the general case)
RUN CGO_ENABLED=0 make build

WORKDIR /setup
FROM registry.fedoraproject.org/fedora:44

COPY ./test/scripts ./test/scripts/
COPY Schutzfile .
COPY pyproject.toml .
RUN ./test/scripts/setup-osbuild-repo
RUN ./test/scripts/install-dependencies
# podman mount needs this
RUN mkdir -p /etc/containers/networks
# Fast-track osbuild so we don't depend on the "slow" Fedora release process to implement new features in bib
RUN dnf install -y dnf-plugins-core \
&& dnf copr enable -y @osbuild/osbuild \
&& dnf install -y libxcrypt-compat wget osbuild osbuild-ostree osbuild-depsolve-dnf osbuild-lvm2 osbuild-virt-deps openssl subscription-manager \
&& dnf clean all

COPY go.mod go.sum .
RUN go mod download
COPY --from=builder /build/bin/image-builder /usr/bin/

WORKDIR /app
ENTRYPOINT ["/usr/bin/image-builder"]
VOLUME /output
WORKDIR /output
# XXX: add "store" flag like bib
VOLUME /var/cache/image-builder/store
VOLUME /var/lib/containers/storage

# Mark the working directory as safe for git
RUN git config --global --add safe.directory /app
LABEL description="This tools allows to build and deploy disk-images."
LABEL io.k8s.description="This tools allows to build and deploy disk-images."
LABEL io.k8s.display-name="Image Builder"
LABEL io.openshift.tags="base fedora44"
LABEL summary="A container to create disk-images."
37 changes: 0 additions & 37 deletions Containerfile.image-builder

This file was deleted.

4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ BASE_CONTAINER_IMAGE_NAME?=registry.fedoraproject.org/fedora
BASE_CONTAINER_IMAGE_TAG?=43
BASE_CONTAINER_IMAGE?=${BASE_CONTAINER_IMAGE_NAME}:${BASE_CONTAINER_IMAGE_TAG}

CONTAINERFILE=Containerfile
CONTAINERFILE=devel/Containerfile
CONTAINER_IMAGE?=osbuild-images_$(shell echo $(BASE_CONTAINER_IMAGE) | tr '/:.' '_')
CONTAINER_EXECUTABLE?=podman

Expand Down Expand Up @@ -246,5 +246,3 @@ $(BUILDDIR)/:

$(BUILDDIR)/%/:
mkdir -p "$@"


48 changes: 20 additions & 28 deletions devel/Containerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
FROM registry.fedoraproject.org/fedora:43 AS builder
RUN dnf install -y git-core golang gpgme-devel libassuan-devel libvirt-devel && mkdir -p /build/bib
## Run with --build-context=images=../images to build with local changes
COPY --from=images . /images
COPY . /build
WORKDIR /build
RUN go mod edit -replace github.com/osbuild/images=../images
RUN go mod tidy
RUN make build
ARG BASE_CONTAINER_IMAGE=registry.fedoraproject.org/fedora:latest
FROM ${BASE_CONTAINER_IMAGE}

FROM registry.fedoraproject.org/fedora:43
# Fast-track osbuild so we don't depend on the "slow" Fedora release process to implement new features in bib
RUN dnf install -y dnf-plugins-core \
&& dnf copr enable -y @osbuild/osbuild \
&& dnf install -y libxcrypt-compat wget osbuild osbuild-ostree osbuild-depsolve-dnf osbuild-lvm2 openssl subscription-manager libvirt-libs \
&& dnf clean all
# The Fedora 41 container doesn't have python3 installed by default
RUN dnf install -y python3

# copy as bootc-image-builder
COPY --from=builder /build/bin/image-builder /usr/bin/bootc-image-builder
# Host check test dependencies
RUN dnf install -y kernel kernel-debug

ENTRYPOINT ["/usr/bin/bootc-image-builder"]
VOLUME /output
WORKDIR /output
VOLUME /store
VOLUME /rpmmd
VOLUME /var/lib/containers/storage
WORKDIR /setup

LABEL description="This tools allows to build and deploy disk-images from bootc container inputs."
LABEL io.k8s.description="This tools allows to build and deploy disk-images from bootc container inputs."
LABEL io.k8s.display-name="Bootc Image Builder"
LABEL io.openshift.tags="base fedora42"
LABEL summary="A container to create disk-images from bootc container inputs"
COPY ./test/scripts ./test/scripts/
COPY Schutzfile .
COPY pyproject.toml .
RUN ./test/scripts/setup-osbuild-repo
RUN ./test/scripts/install-dependencies

COPY go.mod go.sum .
RUN go mod download

WORKDIR /app

# Mark the working directory as safe for git
RUN git config --global --add safe.directory /app
Loading