docs-fp-o-ci-test/build-antora-container/Containerfile
Hristo Marinov 59854fab48
Some checks failed
Build container image for previewing the Fedora Docs / build (stg) (push) Has been cancelled
Build container image for previewing the Fedora Docs / build (prod) (push) Has been cancelled
Build fedocs container image for Fedora Docs / build (x86_64, latest, buildroot) (push) Successful in 2m49s
Build fedocs container image for Fedora Docs / merge (x86_64, latest, buildroot) (push) Successful in 44s
Build Antora container image for Fedora Docs / build (x86_64, latest, buildroot) (push) Successful in 3m40s
Build Antora container image for Fedora Docs / merge (x86_64, latest, buildroot) (push) Successful in 43s
Work in progress
Signed-off-by: Hristo Marinov <hricky@fedoraproject.org>
2026-09-19 23:24:40 +03:00

145 lines
4.9 KiB
Docker

# SPDX-FileCopyrightText: Fedora Docs maintainers
# SPDX-License-Identifier: MIT
ARG BASEIMAGE_REPO=overridden
ARG BASEIMAGE_TAG=overridden
ARG CHUNKAH_REPO=overridden
ARG CHUNKAH_TAG=overridden
# ARG CHUNKAH_TMP_OCIARCHIVE=overridden
ARG CHUNKAH_TOOL_BASE_IMAGE=overridden
FROM ${BASEIMAGE_REPO}:${BASEIMAGE_TAG} AS antora
ENV NODEJS_VERSION=${NODEJS_VERSION}
ENV ANTORA_VERSION=${ANTORA_VERSION}
# Install the required packages
RUN --mount=type=cache,rw,target=/cache \
--mount=type=cache,dst=/var/cache/dnf \
--mount=type=cache,dst=/var/cache/libdnf5 \
<<EORUN
set -euo pipefail
set -x
export FORCE_COLUMNS=134
rm --force /etc/yum.repos.d/fedora-cisco-openh264.repo
dnf upgrade --assumeyes --refresh --no-allow-downgrade \
--allowerasing
dnf --refresh install --assumeyes --allowerasing \
--no-allow-downgrade --no-docs --setopt=tsflags=nodocs \
--setopt=install_weak_deps=False --best \
--exclude container-selinux \
nodejs${NODEJS_VERSION}-npm \
python3-pyyaml \
git-core
dnf clean all
rm --recursive --force /tmp/* /var/lib/dnf/* /var/cache/dnf/* /var/log/*
npm install \
--global \
@antora/cli@${ANTORA_VERSION} \
@antora/site-generator@${ANTORA_VERSION} \
@antora/lunr-extension \
cheerio \
@asciidoctor/tabs
npm cache clean --force
EORUN
# Original: FROM ${CHUNKAH_REPO}:${CHUNKAH_TAG} AS chunkah
#
# Commented out (not deleted) rather than replaced outright, since it's the
# simplest way to use chunkah again if this workaround is ever dropped:
# chunkah's own image downgrade-installs an EL10-built rpm-sequoia so it can
# read PQC signatures from EL10 target rootfs's (see coreos/chunkah commit
# 0427ee2ab8668073eab836f9c9f1e94b9966e28d) — but that EL10 build assumes an
# x86-64-v3/AVX2 CPU baseline and crashes with SIGILL on this host's CPU.
# We only rechunk Fedora rootfs's, so we don't need PQC support: extract just
# the chunkah binary and run it against a plain Fedora rootfs instead, which
# uses the stock (Fedora-built) rpm-sequoia. Pinned to fedora-minimal:44 to
# match the base chunkah's own Containerfile builds the binary against, to
# avoid a glibc/openssl ABI mismatch (confirmed: fedora-minimal:45 fails with
# a missing libssl.so.3, since the binary was linked against an older
# OpenSSL). Revisit if/when upstream Fedora's rpm-sequoia gains PQC support
# and chunkah drops this hack, or if we ever need to rechunk EL10 rootfs's.
FROM ${CHUNKAH_TOOL_BASE_IMAGE} AS chunkah-tool
ARG CHUNKAH_REPO=overridden
ARG CHUNKAH_TAG=overridden
RUN <<EORUN
set -xeuo pipefail
export FORCE_COLUMNS=134
dnf --refresh install --assumeyes --allowerasing \
--no-allow-downgrade --no-docs --setopt=tsflags=nodocs \
--setopt=install_weak_deps=False --best \
--exclude container-selinux \
openssl \
zlib
dnf clean all
rm --recursive --force /tmp/* /var/lib/dnf/* /var/cache/dnf/* /var/log/*
EORUN
COPY --from=${CHUNKAH_REPO}:${CHUNKAH_TAG} /usr/bin/chunkah /usr/bin/chunkah
ENV CHUNKAH_ROOTFS=/chunkah
# Rechunk
# - Use more layers (128)
FROM chunkah-tool AS chunkah
# ARG CHUNKAH_TMP_OCIARCHIVE=overridden
RUN --mount=from=antora,src=/,target=/chunkah,ro \
--mount=type=bind,target=/run/src,rw \
chunkah build \
--verbose \
--skip-special-files \
--max-layers 128 \
--output oci:/run/src/chunkah
# --output oci:/run/src/${CHUNKAH_TMP_OCIARCHIVE}
# Create the final image from the rechunked oci-archive
# Redeclare ARG for this stage
# ARG CHUNKAH_TMP_OCIARCHIVE=overridden
# ARG IMAGE_TITLE=overridden
# ARG IMAGE_DESCRIPTION=overridden
# ARG IMAGE_SOURCE=overridden
# ARG IMAGE_LICENSES=overridden
# ARG QUAY_EXPIRES_AFTER=overridden
# FROM --after=chunkah oci:${CHUNKAH_TMP_OCIARCHIVE}
FROM --after=chunkah oci:chunkah
# ARG IMAGE_TITLE=overridden
# ARG IMAGE_DESCRIPTION=overridden
# ARG IMAGE_SOURCE=overridden
# ARG IMAGE_LICENSES=overridden
# ARG QUAY_EXPIRES_AFTER=overridden
# The labels are static, so they're hardcoded here instead of being passed in
# as build-args from the workflow.
# LABEL org.opencontainers.image.title="${IMAGE_TITLE}"
# LABEL org.opencontainers.image.description="${IMAGE_DESCRIPTION}"
# LABEL org.opencontainers.image.source="${IMAGE_SOURCE}"
# LABEL org.opencontainers.image.licenses="${IMAGE_LICENSES}"
# LABEL quay.expires-after="${QUAY_EXPIRES_AFTER}"
LABEL org.opencontainers.image.title="Fedora Docs Antora"
LABEL org.opencontainers.image.description="Antora container image for the Fedora Docs build and preview tools"
LABEL org.opencontainers.image.source="https://forge.fedoraproject.org/docs/docs-fp-o"
LABEL org.opencontainers.image.licenses="MIT"
LABEL quay.expires-after="4w"
ENV NODE_PATH=/usr/local/lib/node_modules
WORKDIR /antora
ENTRYPOINT ["antora", "--stacktrace"]