Files
SparkOS/Dockerfile
2025-12-29 19:33:22 +00:00

49 lines
1.3 KiB
Docker

# SparkOS Docker Image
# Multi-stage build for minimal final image size
# Build stage - use gcc image which has all build tools pre-installed
FROM gcc:13-bookworm AS builder
# Set working directory
WORKDIR /build
# Copy source files
COPY src/ ./src/
COPY Makefile .
COPY scripts/ ./scripts/
# Build the init system
RUN make init
# Runtime stage - use Alpine for minimal size
FROM alpine:3.19
# Install file command for testing init binary
# file package provides the file(1) command to determine file type
COPY scripts/docker-install-packages.sh /tmp/
RUN /tmp/docker-install-packages.sh
# Alpine Linux includes BusyBox by default
# BusyBox provides: shell (sh), networking (udhcpc, ip, ping, wget), and core utilities
# This is verified by the test.sh script which shows BusyBox version and available applets
# Create minimal rootfs structure
COPY scripts/docker-setup-rootfs.sh /tmp/
RUN /tmp/docker-setup-rootfs.sh
# Copy built init binary from builder
COPY --from=builder /build/init /sparkos/rootfs/sbin/init
# Set up basic configuration files
COPY scripts/docker-setup-config.sh /tmp/
RUN /tmp/docker-setup-config.sh
# Create a test entrypoint
COPY scripts/test.sh /sparkos/test.sh
RUN chmod +x /sparkos/test.sh
WORKDIR /sparkos
# Set entrypoint
ENTRYPOINT ["/sparkos/test.sh"]