deb-bootc-image-builder-new/Containerfile
2025-09-05 07:10:12 -07:00

63 lines
2 KiB
Docker

# Debian-based bootc-image-builder container
FROM debian:trixie-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
git \
golang-go \
libgpgme-dev \
libassuan-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set up build environment
RUN mkdir -p /build/bib
COPY bib/go.mod bib/go.sum /build/bib/
# Set Go proxy and download dependencies
ARG GOPROXY=https://proxy.golang.org,direct
RUN go env -w GOPROXY=$GOPROXY
RUN cd /build/bib && go mod download
# Copy source and build
COPY . /build
WORKDIR /build
RUN ./build.sh
# Runtime stage
FROM debian:trixie-slim
# Add debian-forge repository for osbuild packages
RUN apt-get update && apt-get install -y \
curl \
gnupg \
ca-certificates \
&& curl -fsSL https://git.raines.xyz/api/packages/particle-os/debian/repository.key | gpg --dearmor -o /etc/apt/keyrings/forgejo-particle-os.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/forgejo-particle-os.gpg] https://git.raines.xyz/api/packages/particle-os/debian trixie main" > /etc/apt/sources.list.d/forgejo.list \
&& apt-get update
# Install runtime dependencies
COPY package-requires.txt .
RUN grep -vE '^#' package-requires.txt | xargs apt-get install -y \
&& rm -f package-requires.txt \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy built binary and data
COPY --from=builder /build/bin/* /usr/bin/
COPY bib/data /usr/share/debian-bootc-image-builder
# Set up entrypoint and volumes
ENTRYPOINT ["/usr/bin/debian-bootc-image-builder"]
VOLUME /output
WORKDIR /output
VOLUME /store
VOLUME /aptcache
VOLUME /var/lib/containers/storage
# Labels
LABEL description="This tool allows to build and deploy disk-images from Debian bootc container inputs."
LABEL io.k8s.description="This tool allows to build and deploy disk-images from Debian bootc container inputs."
LABEL io.k8s.display-name="Debian Bootc Image Builder"
LABEL io.openshift.tags="base debian-trixie"
LABEL summary="A container to create disk-images from Debian bootc container inputs"