first commit

This commit is contained in:
robojerk 2025-08-21 07:31:52 -07:00
commit a61c0e9e0b
20 changed files with 2905 additions and 0 deletions

142
debian_bootc_dockerfile.txt Normal file
View file

@ -0,0 +1,142 @@
FROM debian:trixie-slim
# Install essential packages for bootc compatibility
RUN apt-get update && apt-get install -y \
ostree \
ostree-boot \
systemd \
systemd-boot \
linux-image-amd64 \
grub-efi-amd64 \
openssh-server \
sudo \
curl \
wget \
ca-certificates \
polkitd \
pkexec \
libpolkit-gobject-1-0 \
&& rm -rf /var/lib/apt/lists/*
# Download and install bootc package
RUN wget https://git.raines.xyz/robojerk/-/packages/debian/bootc/1.6.0-1~trixie1/files/495 -O bootc_1.6.0-1~trixie1_amd64.deb && \
dpkg -i bootc_1.6.0-1~trixie1_amd64.deb && \
rm bootc_1.6.0-1~trixie1_amd64.deb
# Create a default user
RUN useradd -m -s /bin/bash -G sudo debian && \
echo "debian:debian123" | chpasswd
# Configure SSH
RUN mkdir -p /home/debian/.ssh && \
chmod 700 /home/debian/.ssh && \
chown debian:debian /home/debian/.ssh
# ===== OSTREE FILESYSTEM TRANSFORMATION =====
# This is the critical step that transforms traditional Debian to OSTree
# Initialize OSTree repository
RUN mkdir -p /ostree/repo && \
ostree init --repo=/ostree/repo --mode=bare-user
# Create OSTree deployment structure
RUN ostree admin init-fs / && \
ostree admin stateroot-init debian
# Create a simple OSTree commit from the current filesystem
RUN mkdir -p /tmp/ostree-commit && \
cd /tmp/ostree-commit && \
# Copy only the files we want in OSTree (exclude special filesystems)
cp -r /bin . && \
cp -r /lib . && \
cp -r /lib64 . && \
cp -r /sbin . && \
cp -r /usr . && \
cp -r /etc . && \
cp -r /var . && \
cp -r /home . && \
cp -r /root . && \
cp -r /boot . && \
# Create essential directories properly
mkdir -p proc && \
mkdir -p sys && \
mkdir -p dev && \
mkdir -p tmp && \
mkdir -p run && \
mkdir -p media && \
mkdir -p mnt && \
mkdir -p ostree && \
# Create OSTree-expected kernel locations
mkdir -p usr/lib/ostree-boot && \
# Debug: check what's in boot directory
echo "Boot directory contents:" && ls -la boot/ && \
# Move kernel and initrd to OSTree-expected location
if [ -f boot/vmlinuz-6.12.41+deb13-amd64 ]; then \
cp boot/vmlinuz-6.12.41+deb13-amd64 usr/lib/ostree-boot/ && \
echo "Kernel copied successfully"; \
else \
echo "Kernel not found!" && \
find boot/ -name "*vmlinuz*" -o -name "*kernel*" 2>/dev/null; \
fi && \
if [ -f boot/initrd.img-6.12.41+deb13-amd64 ]; then \
cp boot/initrd.img-6.12.41+deb13-amd64 usr/lib/ostree-boot/ && \
echo "Initrd copied successfully"; \
else \
echo "Initrd not found!" && \
find boot/ -name "*initrd*" 2>/dev/null; \
fi && \
# Create the commit
ostree commit \
--repo=/ostree/repo \
--branch=debian/trixie/x86_64 \
--subject="Debian trixie system" \
--tree=dir=. && \
echo "OSTree commit created successfully" && \
# Clean up
cd / && rm -rf /tmp/ostree-commit
# Deploy the OSTree commit to create proper deployment structure
# Note: Deployment will be done at runtime when the container boots
RUN echo "OSTree commit created, deployment will be done at runtime" && \
echo "Commit hash: $(ostree rev-parse --repo=/ostree/repo debian/trixie/x86_64)"
# Configure OSTree
RUN mkdir -p /etc/ostree && \
echo "[origin]" > /etc/ostree/remotes.d/origin.conf && \
echo "repo=/ostree/repo" >> /etc/ostree/remotes.d/origin.conf
# Configure bootloader
RUN mkdir -p /boot/loader/entries
# Add bootc compatibility layer script
COPY bootc-compat.sh /usr/local/bin/bootc-compat.sh
RUN chmod +x /usr/local/bin/bootc-compat.sh
# Set up bootc status directory
RUN mkdir -p /usr/lib/bootc
# Create bootc status file
RUN echo '{' > /usr/lib/bootc/status.json && \
echo ' "apiVersion": "org.containers.bootc/v1alpha1",' >> /usr/lib/bootc/status.json && \
echo ' "kind": "BootcHost",' >> /usr/lib/bootc/status.json && \
echo ' "spec": {' >> /usr/lib/bootc/status.json && \
echo ' "image": {' >> /usr/lib/bootc/status.json && \
echo ' "image": "localhost/debian-bootc:latest"' >> /usr/lib/bootc/status.json && \
echo ' }' >> /usr/lib/bootc/status.json && \
echo ' },' >> /usr/lib/bootc/status.json && \
echo ' "status": {' >> /usr/lib/bootc/status.json && \
echo ' "booted": {' >> /usr/lib/bootc/status.json && \
echo ' "image": {' >> /usr/lib/bootc/status.json && \
echo ' "image": "localhost/debian-bootc:latest",' >> /usr/lib/bootc/status.json && \
echo ' "imageDigest": "sha256:$(echo -n '\''debian-bootc'\'' | sha256sum | cut -d'\'' '\'' -f1)"' >> /usr/lib/bootc/status.json && \
echo ' }' >> /usr/lib/bootc/status.json && \
echo ' }' >> /usr/lib/bootc/status.json && \
echo ' }' >> /usr/lib/bootc/status.json && \
echo '}' >> /usr/lib/bootc/status.json
# Set proper labels
LABEL bootc.filesystem="ext4"
LABEL bootc.architecture="x86_64"
LABEL ostree.commit="debian/trixie/x86_64"
CMD ["/usr/local/bin/bootc-compat.sh"]