97 lines
3.6 KiB
Docker
97 lines
3.6 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"
|
|
|
|
# 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
|
|
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 minimal OSTree commit for bootc
|
|
# This is what bootc expects to find in the image
|
|
RUN mkdir -p /tmp/ostree-root && \
|
|
# Copy only essential system directories (exclude virtual filesystems)
|
|
cp -r /usr /tmp/ostree-root/ && \
|
|
cp -r /lib /tmp/ostree-root/ && \
|
|
cp -r /bin /tmp/ostree-root/ && \
|
|
cp -r /sbin /tmp/ostree-root/ && \
|
|
cp -r /etc /tmp/ostree-root/ && \
|
|
cp -r /var /tmp/ostree-root/ && \
|
|
# Create essential directories that don't exist
|
|
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/root && \
|
|
mkdir -p /tmp/ostree-root/home && \
|
|
mkdir -p /tmp/ostree-root/srv && \
|
|
mkdir -p /tmp/ostree-root/opt && \
|
|
mkdir -p /tmp/ostree-root/mnt && \
|
|
mkdir -p /tmp/ostree-root/media && \
|
|
# 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 in the correct sysroot location
|
|
COMMIT_HASH=$(ostree --repo=/sysroot/ostree/repo commit --orphan --subject='Debian bootc Base Image' /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
|
|
RUN echo "=== OSTree Repository Status ===" && \
|
|
ostree --repo=/sysroot/ostree/repo refs && \
|
|
ostree --repo=/sysroot/ostree/repo log debian-atomic/base
|
|
|
|
# Set working directory
|
|
WORKDIR /
|
|
|
|
# Default command
|
|
CMD ["/bin/bash"]
|