particle-os/Containerfile.minimal
robojerk f9fb8d3bd0 Fix critical PATH issues and add related projects to README
- Fixed sfdisk PATH issue in Containerfile.base (sfdisk is in /usr/sbin)
- Updated Containerfile.minimal to use full path for grub-install
- Enhanced test-bootc-deployment.sh to properly check utility locations
- Added comprehensive section about related projects (apt-ostree, deb-bootupd, debian-bootc-corrected)
- Updated validation script to handle Debian-specific utility locations
- Improved error messages with specific solutions for PATH and utility issues

This addresses the critical requirements from scope.md regarding disk utilities
and PATH environment variables for bootc deployment.
2025-08-10 18:15:04 -07:00

113 lines
4.3 KiB
Text

# Particle-OS Minimal Containerfile
# Builds on the base image and adds bootc, apt-ostree, and deb-bootupd
# This creates the Phase 1 deliverable: a working Debian bootc image
FROM particle-os:base
# Install additional packages needed for bootc and OSTree
RUN apt-get update && apt-get install -y \
# Bootc and container runtime
podman \
# OSTree support
ostree \
# OSTree-specific packages
ostree-boot \
# Kernel and modules (specific versions for OSTree)
linux-image-amd64 \
linux-headers-amd64 \
# Additional utilities for bootc
xorriso \
# Additional utilities for testing
qemu-system-x86 \
&& rm -rf /var/lib/apt/lists/*
# Install your custom packages (apt-ostree and deb-bootupd)
# Note: These will need to be available in a repository or built locally
RUN echo "Installing apt-ostree and deb-bootupd..." && \
# TODO: Add repository configuration for your packages
# apt-get install -y apt-ostree deb-bootupd
echo "Packages will be installed from your repository"
# Install bootc
RUN curl -L -o /usr/local/bin/bootc https://github.com/containers/bootc/releases/latest/download/bootc-linux-amd64 && \
chmod +x /usr/local/bin/bootc
# Set up OSTree configuration
RUN mkdir -p /etc/ostree && \
echo "OSTREE_BOOTABLE=true" > /etc/ostree/ostree.conf && \
echo "OSTREE_OSNAME=particle-os" >> /etc/ostree/ostree.conf && \
echo "OSTREE_OSVERSION=0.1.0" >> /etc/ostree/ostree.conf
# Create necessary directories for bootc and OSTree
RUN mkdir -p /usr/lib/ostree-boot && \
mkdir -p /boot/efi && \
mkdir -p /boot/grub && \
mkdir -p /usr/lib/kernel && \
mkdir -p /usr/lib/modules && \
mkdir -p /usr/lib/firmware
# Set up kernel modules according to OSTree conventions
RUN KERNEL_VERSION=$(dpkg-query -W -f='${Version}' linux-image-amd64 | sed 's/-.*//') && \
echo "Kernel version: $KERNEL_VERSION" && \
mkdir -p "/usr/lib/modules/$KERNEL_VERSION" && \
mkdir -p "/usr/lib/kernel/$KERNEL_VERSION" && \
# Create proper symlinks for kernel modules
ln -sf "/usr/src/linux-headers-$KERNEL_VERSION" "/usr/lib/modules/$KERNEL_VERSION/build" && \
ln -sf "/usr/src/linux-headers-$KERNEL_VERSION" "/usr/lib/kernel/$KERNEL_VERSION/build" && \
# Copy kernel modules to proper location
cp -r "/usr/src/linux-headers-$KERNEL_VERSION" "/usr/lib/modules/$KERNEL_VERSION/source" && \
# Set up module dependencies
depmod -b "/usr/lib/modules/$KERNEL_VERSION" "$KERNEL_VERSION"
# Configure bootloader according to OSTree conventions
RUN /usr/sbin/grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/usr/lib/ostree-boot
# Set up systemd services
RUN systemctl enable systemd-timesyncd && \
systemctl enable systemd-networkd
# Create bootc configuration
RUN mkdir -p /etc/bootc && \
echo '{"bootc": {"install": {"target": "disk"}}}' > /etc/bootc/config.json
# Set up OSTree repository structure
RUN mkdir -p /ostree/repo && \
mkdir -p /sysroot/ostree && \
mkdir -p /var/lib/ostree/repo
# Create OSTree deployment structure
RUN mkdir -p /sysroot/ostree/deploy/particle-os/deploy && \
mkdir -p /sysroot/ostree/deploy/particle-os/var && \
mkdir -p /sysroot/ostree/deploy/particle-os/usr
# CRITICAL: Test bootc functionality
RUN bootc --version && \
echo "bootc installation verified successfully"
# Set up user environment
USER particle
WORKDIR /home/particle
# Switch back to root for system operations
USER root
WORKDIR /root
# Label the image with OSTree-compliant labels
LABEL org.opencontainers.image.title="Particle-OS Minimal"
LABEL org.opencontainers.image.description="Minimal bootable Debian bootc image with deployment utilities"
LABEL org.opencontainers.image.version="0.1.0"
LABEL org.opencontainers.image.vendor="Particle-OS Project"
LABEL org.opencontainers.image.source="https://github.com/your-org/particle-os"
LABEL org.opencontainers.image.revision="0.1.0"
LABEL org.opencontainers.image.created="2024-01-01T00:00:00Z"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.ref.name="particle-os-minimal"
LABEL org.opencontainers.image.ostree.osname="particle-os"
LABEL org.opencontainers.image.ostree.osversion="0.1.0"
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD systemctl is-system-running && bootc --version && ostree --version || exit 1
# Default command
CMD ["/bin/bash"]