Refactor Containerfile with new build scripts and configs
Updated the Containerfile to include new configurations and scripts for the build process.
This commit is contained in:
+30
-40
@@ -18,61 +18,51 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# MULTI-STAGE BUILD ARCHITECTURE
|
# MULTI-STAGE BUILD ARCHITECTURE
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This Containerfile follows the Bluefin architecture pattern as implemented in
|
|
||||||
# @projectbluefin/distroless. The architecture layers OCI containers together:
|
|
||||||
#
|
|
||||||
# 1. Context Stage (ctx) - Combines resources from:
|
|
||||||
# - Local build scripts and custom files
|
|
||||||
#
|
|
||||||
# 2. Base Image Options:
|
|
||||||
# - `ghcr.io/ublue-os/silverblue-main:latest` (Fedora and GNOME)
|
|
||||||
# - `ghcr.io/ublue-os/base-main:latest` (Fedora and no desktop
|
|
||||||
# - `quay.io/centos-bootc/centos-bootc:stream10 (CentOS-based)`
|
|
||||||
#
|
|
||||||
# See: https://docs.projectbluefin.io/contributing/ for architecture diagram
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# Context stage - combine local and imported OCI container resources
|
|
||||||
FROM scratch AS ctx
|
FROM scratch AS ctx
|
||||||
|
|
||||||
|
# Kopiere die Build-Skripte und die neuen Konfigurations-Artefakte in den Kontext
|
||||||
COPY build /build
|
COPY build /build
|
||||||
|
COPY configs /configs
|
||||||
|
COPY scripts /scripts
|
||||||
|
|
||||||
## Alternative base images, no desktop included (uncomment to use):
|
###############################################################################
|
||||||
|
# BASE IMAGE
|
||||||
|
###############################################################################
|
||||||
FROM quay.io/fedora/fedora-kinoite:44
|
FROM quay.io/fedora/fedora-kinoite:44
|
||||||
# FROM quay.io/centos-bootc/centos-bootc:stream10
|
|
||||||
|
|
||||||
## Alternative GNOME OS base image (uncomment to use):
|
|
||||||
# FROM quay.io/gnome_infrastructure/gnome-build-meta:gnomeos-nightly
|
|
||||||
|
|
||||||
### /opt
|
|
||||||
## Some bootable images, like Fedora, have /opt symlinked to /var/opt, in order to
|
|
||||||
## make it mutable/writable for users. However, some packages write files to this directory,
|
|
||||||
## thus its contents might be wiped out when bootc deploys an image, making it troublesome for
|
|
||||||
## some packages. Eg, google-chrome, docker-desktop.
|
|
||||||
##
|
|
||||||
## Uncomment the following line if one desires to make /opt immutable and be able to be used
|
|
||||||
## by the package manager.
|
|
||||||
|
|
||||||
|
### /opt (Unverändert)
|
||||||
# RUN rm /opt && mkdir /opt
|
# RUN rm /opt && mkdir /opt
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# EXECUTION STAGE
|
||||||
|
###############################################################################
|
||||||
|
# Hier werden die Skripte aus dem Kontext-Stage ausgeführt
|
||||||
RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
|
RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
|
||||||
|
--mount=type=bind,from=ctx,source=/configs,target=/configs \
|
||||||
|
--mount=type=bind,from=ctx,source=/scripts,target=/scripts \
|
||||||
--mount=type=cache,dst=/var/cache \
|
--mount=type=cache,dst=/var/cache \
|
||||||
--mount=type=cache,dst=/var/log \
|
--mount=type=cache,dst=/var/log \
|
||||||
--mount=type=tmpfs,dst=/tmp \
|
--mount=type=tmpfs,dst=/tmp \
|
||||||
for s in /ctx/build/*.sh; do echo "Running $s" && sh "$s" || exit 1; done
|
for s in /ctx/build/*.sh; do echo "Running $s" && sh "$s" || exit 1; done
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# CONFIGURATION LAYER (Der "saubere" Teil)
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
# Deklaration der Verzeichnisse für systemd-tmpfiles, um bootc-Linting-Warnungen zu vermeiden.
|
# 1. Kopiere die Filesystem-Fixes (tmpfiles.d)
|
||||||
# Dies stellt sicher, dass /var/lib/dnf und /var/lib/rpm beim Booten sauber existieren.
|
# COPY erstellt die Zielpfade automatisch, falls sie noch nicht existieren.
|
||||||
RUN mkdir -p /etc/tmpfiles.d/ && \
|
COPY configs/bootc-fix.conf /etc/tmpfiles.d/
|
||||||
echo "d /var/lib/dnf 0755 root root -" > /etc/tmpfiles.d/bootc-fix.conf && \
|
|
||||||
echo "d /var/lib/rpm 0755 root root -" >> /etc/tmpfiles.d/bootc-fix.conf && \
|
|
||||||
mkdir -p /etc/systemd/system/bootc-fetch-apply-updates.service.d/ && \
|
|
||||||
echo -e "[Service]\nExecStart=\nExecStart=/usr/bin/bootc upgrade --staged --quiet" > \
|
|
||||||
/etc/systemd/system/bootc-fetch-apply-updates.service.d/override.conf
|
|
||||||
|
|
||||||
### LINTING
|
# 2. Kopiere den Systemd-Override (mit der neuen Update-Logik)
|
||||||
## Verify final image and contents are correct.
|
COPY configs/bootc-override.conf /etc/systemd/system/bootc-fetch-apply-updates.service.d/override.conf
|
||||||
|
|
||||||
|
# 3. Kopiere das Benachrichtigungs-Skript
|
||||||
|
# Wichtig: Das Skript muss auf deinem Host bereits mit 'chmod +x' markiert sein!
|
||||||
|
COPY scripts/notify-bootc-user.sh /usr/bin/
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# LINTING
|
||||||
|
###############################################################################
|
||||||
RUN bootc container lint
|
RUN bootc container lint
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user