debian-atomic/variants/debian-bootc-base/Containerfile
robojerk a207949d9f Add comprehensive documentation and improve container configuration
- Add technical report on Debian atomic image creation
- Add Fedora tools bootable instructions and implementation report
- Add apt-tool blocking implementation documentation
- Add environment configuration example
- Update .gitignore with better artifact blocking
- Update justfile and Containerfile configurations
- Improve variants configuration for debian-bootc-base
2025-08-19 20:51:01 -07:00

109 lines
4.5 KiB
Docker

# Debian bootc Base Image
# Creates a bootc-compatible base starting from pure Debian
FROM debian:trixie-slim
# Label the image
LABEL org.debian-atomic.variant="debian-bootc-base"
LABEL org.debian-atomic.description="Debian bootc Base Image - Pure Debian with bootc components"
LABEL org.debian-atomic.fedora-equivalent="fedora-bootc"
# Critical: This label marks the image as bootc-compatible
LABEL containers.bootc="1"
# Install essential system packages
RUN apt-get update && apt-get install -y \
# Core system components
systemd systemd-sysv dbus util-linux \
# Linux kernel and boot components
linux-image-amd64 linux-headers-amd64 initramfs-tools \
# Bootloader and UEFI support
grub2 grub-pc efibootmgr \
# OSTree components
ostree ostree-boot \
# Container runtime
podman skopeo buildah \
# Essential tools
bash coreutils vim less curl wget sudo passwd \
# Network and SSH
network-manager iwd wireguard-tools openssh-client \
# Development tools
make gcc python3 python3-pip \
# Clean up
&& rm -rf /var/lib/apt/lists/*
# Copy and install our bootc package
COPY bootc_1.6.0-1~trixie1_amd64.deb /tmp/
RUN dpkg -i /tmp/bootc_1.6.0-1~trixie1_amd64.deb || apt-get install -f -y && \
rm /tmp/bootc_1.6.0-1~trixie1_amd64.deb && \
echo "bootc installed successfully" && \
bootc --version
# Initialize OSTree repository in the correct location for bootc
# Use bare mode for now - bare-split-xattrs doesn't allow writing during build
RUN mkdir -p /sysroot/ostree/repo && \
ostree --repo=/sysroot/ostree/repo init --mode=bare
# Add OSTree configuration
COPY ostree-prepare-root.conf /usr/lib/ostree/prepare-root.conf
RUN mkdir -p /etc/ostree && cp /usr/lib/ostree/prepare-root.conf /etc/ostree/prepare-root.conf
RUN mkdir -p /usr/share/ostree && cp /usr/lib/ostree/prepare-root.conf /usr/share/ostree/prepare-root.conf
# Set up systemd as init
RUN systemctl set-default multi-user.target
# Create a complete OSTree commit for bootc
# This is what bootc expects to find in the image - a complete system tree
RUN mkdir -p /tmp/ostree-root && \
# Copy essential system directories to create a complete system commit
# We'll copy the core directories that make up a bootable system
cp -r /usr /tmp/ostree-root/ && \
cp -r /lib /tmp/ostree-root/ && \
cp -r /lib64 /tmp/ostree-root/ 2>/dev/null || true && \
cp -r /bin /tmp/ostree-root/ && \
cp -r /sbin /tmp/ostree-root/ && \
cp -r /etc /tmp/ostree-root/ && \
cp -r /var /tmp/ostree-root/ && \
cp -r /root /tmp/ostree-root/ && \
cp -r /home /tmp/ostree-root/ && \
cp -r /opt /tmp/ostree-root/ 2>/dev/null || true && \
cp -r /srv /tmp/ostree-root/ 2>/dev/null || true && \
cp -r /mnt /tmp/ostree-root/ 2>/dev/null || true && \
cp -r /media /tmp/ostree-root/ 2>/dev/null || true && \
# Create essential directories that don't exist or were excluded
mkdir -p /tmp/ostree-root/tmp && \
mkdir -p /tmp/ostree-root/run && \
mkdir -p /tmp/ostree-root/dev && \
mkdir -p /tmp/ostree-root/proc && \
mkdir -p /tmp/ostree-root/sys && \
mkdir -p /tmp/ostree-root/boot && \
mkdir -p /tmp/ostree-root/sysroot && \
# Clean up temporary and unnecessary files
rm -rf /tmp/ostree-root/var/cache/* && \
rm -rf /tmp/ostree-root/var/log/* && \
rm -rf /tmp/ostree-root/var/tmp/* && \
rm -rf /tmp/ostree-root/tmp/* && \
# Create the commit from the complete system structure
# This creates an OSTree commit that represents a complete bootable system
COMMIT_HASH=$(ostree --repo=/sysroot/ostree/repo commit --orphan --subject='Debian bootc Base Image - Complete System' /tmp/ostree-root) && \
echo "OSTree commit created: $COMMIT_HASH" && \
# Create a ref that bootc can find
ostree --repo=/sysroot/ostree/repo refs --create=debian-atomic/base $COMMIT_HASH && \
echo "OSTree ref created: debian-atomic/base" && \
# Clean up
rm -rf /tmp/ostree-root
# Verify the commit was created and check its structure
RUN echo "=== OSTree Repository Status ===" && \
ostree --repo=/sysroot/ostree/repo refs && \
echo "=== OSTree Commit Log ===" && \
ostree --repo=/sysroot/ostree/repo log debian-atomic/base && \
echo "=== OSTree Commit Structure ===" && \
ostree --repo=/sysroot/ostree/repo ls debian-atomic/base && \
echo "=== OSTree Repository Mode ===" && \
ostree --repo=/sysroot/ostree/repo config get core.mode
# Set working directory
WORKDIR /
# Default command
CMD ["/bin/bash"]