particle-os/02-installer-bootc/Containerfile
2025-08-07 01:04:22 -07:00

198 lines
No EOL
6.6 KiB
Docker

FROM debian:trixie
# Configure apt-cacher-ng proxy if available
ARG APT_CACHER_NG_PROXY
RUN if [ -n "$APT_CACHER_NG_PROXY" ]; then \
echo "Acquire::http::Proxy \"$APT_CACHER_NG_PROXY\";" > /etc/apt/apt.conf.d/99proxy; \
echo "Acquire::https::Proxy \"$APT_CACHER_NG_PROXY\";" >> /etc/apt/apt.conf.d/99proxy; \
fi
# Install essential packages for a bootc installer
RUN apt-get update && apt-get install -y \
systemd \
dbus \
sudo \
systemd-sysv \
systemd-timesyncd \
network-manager \
openssh-server \
curl \
wget \
vim \
less \
htop \
# Calamares and its dependencies
calamares \
calamares-settings-debian \
# X11 and display manager for graphical installer
xorg \
xinit \
lightdm \
openbox \
xterm \
# Qt and X11 dependencies for Calamares
libxcb-cursor0 \
libxcb-xinerama0 \
libxcb-randr0 \
libqt6gui6 \
libqt6widgets6 \
qml6-module-qtquick \
qml6-module-qtquick-controls \
qml6-module-qtquick-layouts \
# Bootc for atomic deployment (will install from source)
# bootc \
# Additional installer tools
parted \
gdisk \
fdisk \
e2fsprogs \
dosfstools \
&& rm -rf /var/lib/apt/lists/*
# Install bootc dependencies and ISO creation tools
RUN apt-get update && apt-get install -y \
# Bootc and ostree dependencies (excluding libostree-1-1 as we'll install custom version)
libarchive13t64 \
libavahi-client3 \
libavahi-common3 \
libavahi-glib1 \
libcurl3t64-gnutls \
libgpgme11t64 \
libglib2.0-0t64 \
libapt-pkg7.0 \
podman \
skopeo \
# Linux kernel for bootable ISO
linux-image-amd64 \
# ISO creation tools
genisoimage \
isolinux \
xorriso \
# Additional useful tools
squashfs-tools \
live-boot \
live-config \
live-tools \
# Development and debugging tools
strace \
lsof \
procps \
psmisc \
# Network tools
net-tools \
iproute2 \
# File system tools
mount \
util-linux \
# Text processing (grep, sed, awk are usually pre-installed)
# grep \
# sed \
# awk \
# Compression tools
gzip \
bzip2 \
xz-utils \
# Archive tools
tar \
zip \
unzip \
# Build tools
build-essential \
pkg-config \
cmake \
git \
# Python for potential scripts
python3 \
python3-pip \
# Additional utilities
tree \
mc \
nano \
&& rm -rf /var/lib/apt/lists/*
# Copy custom packages into the container
COPY 02-installer-bootc/debs/ /tmp/custom-packages/
# Install custom bootc, ostree, and apt-ostree packages
RUN echo "Installing custom packages..." && \
cd /tmp/custom-packages && \
echo "Installing bootc packages..." && \
dpkg -i bootc_1.5.1-1~trixie1_amd64.deb bootc-dev_1.5.1-1~trixie1_amd64.deb || true && \
echo "Installing ostree packages..." && \
dpkg -i ostree_2025.2-1~trixie1_amd64.deb libostree-1-1_2025.2-1~trixie1_amd64.deb libostree-dev_2025.2-1~trixie1_amd64.deb ostree-boot_2025.2-1~trixie1_amd64.deb || true && \
echo "Installing apt-ostree package..." && \
dpkg -i apt-ostree_0.1.0-1~trixie1_amd64.deb || true && \
echo "Fixing dependencies..." && \
apt-get install -f -y && \
echo "Cleaning up..." && \
rm -rf /tmp/custom-packages
# Create ISO creation workspace
RUN mkdir -p /opt/iso-workspace /opt/iso-output
WORKDIR /opt/iso-workspace
# Enable systemd services
RUN systemctl enable systemd-timesyncd
RUN systemctl enable NetworkManager
RUN systemctl enable ssh
RUN systemctl enable lightdm
RUN systemctl set-default graphical.target
# Create a default user for the installer environment
RUN useradd -m -s /bin/bash -G sudo installer
RUN echo "installer:installer" | chpasswd
# Set up basic system configuration
RUN echo "debian-atomic-installer" > /etc/hostname
# Copy Calamares configuration
COPY 02-installer-bootc/calamares-config/ /etc/calamares/
# Copy installation scripts
COPY 02-installer-bootc/scripts/ /usr/local/bin/
RUN chmod +x /usr/local/bin/*.sh
# Create simple ISO creation script
RUN echo '#!/bin/bash' > /usr/local/bin/create-iso-complete.sh && \
echo 'echo "Creating ISO with bootc integration..."' >> /usr/local/bin/create-iso-complete.sh && \
echo 'mkdir -p boot/grub isolinux live' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "bootc version: $(bootc --version 2>/dev/null || echo not available)"' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "ostree version: $(ostree --version 2>/dev/null || echo not available)"' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "apt-ostree version: $(apt-ostree --version 2>/dev/null || echo not available)"' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "Creating placeholder kernel and initrd..."' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "placeholder kernel" > boot/vmlinuz' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "placeholder initrd" > boot/initrd.img' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "Creating bootable ISO..."' >> /usr/local/bin/create-iso-complete.sh && \
echo 'genisoimage -o /opt/iso-output/debian-atomic-installer-complete.iso -r -V "DEBIAN_ATOMIC" .' >> /usr/local/bin/create-iso-complete.sh && \
echo 'echo "✅ ISO created: /opt/iso-output/debian-atomic-installer-complete.iso"' >> /usr/local/bin/create-iso-complete.sh && \
chmod +x /usr/local/bin/create-iso-complete.sh
# Set up Calamares to autostart
RUN mkdir -p /etc/systemd/system/graphical.target.wants/
RUN ln -sf /usr/lib/systemd/system/calamares.service /etc/systemd/system/graphical.target.wants/
# Set environment variables
ENV DEBIAN_ATOMIC_VERSION="1.0"
ENV ISO_WORKSPACE="/opt/iso-workspace"
ENV ISO_OUTPUT="/opt/iso-output"
# Add labels for better container management
LABEL maintainer="Debian Atomic Desktop Project"
LABEL description="Debian Atomic Desktop Installer with ISO creation tools"
LABEL version="1.0"
LABEL org.opencontainers.image.source="https://github.com/your-repo/particle-os"
# Clean up
RUN apt-get clean
# Create a helpful startup message
RUN echo 'echo "=== Debian Atomic Desktop Installer Environment ==="' >> /root/.bashrc && \
echo 'echo "Available commands:"' >> /root/.bashrc && \
echo 'echo " create-iso-complete.sh - Create comprehensive bootable ISO"' >> /root/.bashrc && \
echo 'echo " bootc --help - Show bootc help"' >> /root/.bashrc && \
echo 'echo " calamares - Launch installer"' >> /root/.bashrc && \
echo 'echo "Workspace: $ISO_WORKSPACE"' >> /root/.bashrc && \
echo 'echo "Output: $ISO_OUTPUT"' >> /root/.bashrc
# Set the default command
CMD ["/bin/bash"]