particle-os/Containerfile.base
2025-08-10 19:03:24 -07:00

106 lines
3.1 KiB
Text

# Particle-OS Base Containerfile
# Starts with debian:trixie-slim and sets up the foundation
# This is the base layer that all other images will build upon
FROM debian:trixie-slim
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# Update package lists and install essential packages
RUN apt-get update && apt-get install -y \
# Essential system packages
systemd \
systemd-sysv \
dbus \
sudo \
curl \
wget \
gnupg \
ca-certificates \
# Locale support
locales \
# Basic utilities
vim-tiny \
less \
procps \
# Network utilities
iproute2 \
net-tools \
# Time synchronization
systemd-timesyncd \
# CRITICAL: Disk utilities for bootc deployment (from scope.md)
util-linux \
parted \
e2fsprogs \
dosfstools \
grub-efi-amd64 \
efibootmgr \
# Additional filesystem utilities
fdisk \
gdisk \
&& rm -rf /var/lib/apt/lists/*
# Configure locales
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
# CRITICAL: Fix PATH environment issues (from scope.md)
# Ensure PATH includes /usr/sbin and /sbin for disk utilities
ENV PATH="/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"
# Create OSTree-compliant filesystem structure
RUN mkdir -p /ostree && \
mkdir -p /sysroot && \
mkdir -p /boot && \
mkdir -p /usr/lib/ostree-boot && \
mkdir -p /usr/lib/modules && \
mkdir -p /usr/lib/kernel && \
mkdir -p /usr/lib/firmware && \
mkdir -p /etc/ostree && \
mkdir -p /var/lib/ostree && \
mkdir -p /var/home && \
ln -sf ../var/home /home
# Set up basic system configuration
RUN echo "root:particle" | chpasswd && \
echo "particle ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/particle
# Create particle user
RUN useradd -m -s /bin/bash particle && \
echo "particle:particle" | chpasswd && \
usermod -aG sudo particle
# CRITICAL: Verify disk utilities are available and working
RUN which sfdisk && sfdisk --version && \
which parted && parted --version && \
which mkfs.ext4 && mkfs.ext4 -V && \
which mkfs.fat && mkfs.fat --help && \
which grub-install && grub-install --version && \
which efibootmgr && efibootmgr --version
# Set working directory
WORKDIR /root
# Label the image with OSTree-compliant labels
LABEL org.opencontainers.image.title="Particle-OS Base"
LABEL org.opencontainers.image.description="Base Debian image for Particle-OS with bootc 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-base"
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD systemctl is-system-running || exit 1
# Default command
CMD ["/bin/bash"]