diff --git a/.github/workflows/fc-asciidoctor-pr.yaml b/.github/workflows/fc-asciidoctor-pr.yaml new file mode 100644 index 000000000..17aadaa89 --- /dev/null +++ b/.github/workflows/fc-asciidoctor-pr.yaml @@ -0,0 +1,41 @@ +name: fc-asciidoctor-pr +on: + pull_request: + paths: + - utilities/fc-asciidoctor/** + - .github/workflows/fc-asciidoctor-pr.yaml +jobs: + build: + env: + context: utilities/fc-asciidoctor + image_name: fc-asciidoctor + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + + - name: Get image tags + id: image_tags + uses: redhat-cop/github-actions/get-image-version@master + with: + IMAGE_CONTEXT_DIR: ${{ env.CONTEXT_DIR }} + + - name: Build image + uses: redhat-actions/buildah-build@v2 + with: + context: ${{ env.context }} + dockerfiles: | + ./${{ env.context }}/Dockerfile + image: ${{ env.image_name }} + oci: true + tags: ${{ steps.check_version.outputs.IMAGE_TAGS }} + + - name: Test image + run: | + echo "Running: podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} git --version" + podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} git --version + echo "Running: podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} asciidoctor --version" + podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} asciidoctor --version + echo "Running: podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} asciidoctor-pdf --version" + podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} asciidoctor-pdf --version + echo "Running: podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} pandoc --version" + podman run ${image_name}:${{ steps.check_version.outputs.IMAGE_TAGS }} pandoc --version diff --git a/.github/workflows/fc-asciidoctor-publish.yaml b/.github/workflows/fc-asciidoctor-publish.yaml new file mode 100644 index 000000000..811fd6081 --- /dev/null +++ b/.github/workflows/fc-asciidoctor-publish.yaml @@ -0,0 +1,44 @@ +name: fc-asciidoctor-publish +on: + push: + branches: + - master + tags: + - '*' + paths: + - utilities/fc-asciidoctor/version.json + - .github/workflows/fc-asciidoctor-publish.yaml +jobs: + build: + env: + context: utilities/fc-asciidoctor + image_name: fc-asciidoctor + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@master + + - name: Get image tags + id: image_tags + uses: redhat-cop/github-actions/get-image-version@master + with: + IMAGE_CONTEXT_DIR: ${{ env.CONTEXT_DIR }} + + - name: Build image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + context: ${{ env.context }} + dockerfiles: | + ./${{ env.context }}/Dockerfile + image: ${{ env.image_name }} + tags: "${{ steps.image_tags.outputs.IMAGE_TAGS }}" + + - name: Push to Quay + id: push_to_quay + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build_image.outputs.image }} + registry: ${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + tags: ${{ steps.build_image.outputs.tags }} diff --git a/utilities/fc-asciidoctor/.openshift/bc-fc-asciidoctor.yml b/utilities/fc-asciidoctor/.openshift/bc-fc-asciidoctor.yml new file mode 100644 index 000000000..abec5dde1 --- /dev/null +++ b/utilities/fc-asciidoctor/.openshift/bc-fc-asciidoctor.yml @@ -0,0 +1,57 @@ +--- +apiVersion: template.openshift.io/v1 +kind: Template +labels: + template: fc-asciidoctor +metadata: + labels: + app.kubernetes.io/name: fc-asciidoctor + app.kubernetes.io/version: "1.2.0" + annotations: + description: asciidoctor utility image + tags: asciidoctor, fc + name: fc-asciidoctor +objects: +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: "fc-asciidoctor" + spec: + output: + to: + kind: "ImageStreamTag" + name: "fc-asciidoctor:latest" + source: + contextDir: "${CONTEXT_DIR}" + git: + uri: "${SOURCE_REPOSITORY_URL}" + ref: "${SOURCE_REPOSITORY_REF}" + strategy: + dockerStrategy: + dockerfilePath: Dockerfile + resources: + requests: + cpu: 1 + memory: "512Mi" + limits: + cpu: 2 + memory: "1Gi" +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: fc-asciidoctor + spec: + lookupPolicy: + local: true +parameters: +- description: Path within Git repository to build; empty for root of repository + name: CONTEXT_DIR + value: gitlab-runners/fc-asciidoctor +- description: Git branch/tag reference + name: SOURCE_REPOSITORY_REF + value: master +- description: Git source URL for application + name: SOURCE_REPOSITORY_URL + required: true + value: https://github.com/redhat-cop/containers-quickstarts + diff --git a/utilities/fc-asciidoctor/Dockerfile b/utilities/fc-asciidoctor/Dockerfile new file mode 100644 index 000000000..a35a5cc94 --- /dev/null +++ b/utilities/fc-asciidoctor/Dockerfile @@ -0,0 +1,34 @@ +FROM registry.fedoraproject.org/fedora:latest + +LABEL MAINTAINERS="Red Hat Services" + +RUN dnf -y update && \ + dnf -y install asciidoctor pandoc python3-pip && \ + dnf clean all + +RUN gem install asciidoctor-diagram asciidoctor-pdf kramdown-asciidoc rouge + + +# Installing Python dependencies for additional +# functionnalities as diagrams or syntax highligthing +RUN pip3 install --no-cache-dir \ + actdiag \ + 'blockdiag[pdf]' \ + 'nwdiag[pdf]' \ + seqdiag + + +WORKDIR /documents +VOLUME /documents + +RUN mkdir /home/work \ + && chgrp -R 0 /home/work \ + && chmod -R g=u /home/work + +ENV HOME=/home/work + + +USER 1001 + +CMD ["/bin/bash"] + diff --git a/utilities/fc-asciidoctor/README.md b/utilities/fc-asciidoctor/README.md new file mode 100644 index 000000000..471245ef2 --- /dev/null +++ b/utilities/fc-asciidoctor/README.md @@ -0,0 +1,17 @@ +# fc-asciidoctor + +A utility image for the FC image + asciidoctor. + +Contains the primary used asciidoctor-pdf for generating reports. + +It's base is from https://github.com/asciidoctor/docker-asciidoctor but now Fedora (fc) based. + +## Purpose + +Useful for environments where these libraries/tools are needed such as: +* local development +* CI tools that do not require specific CI tooling configuraiton, such as GiLab Jobs. + +## Published + +[https://quay.io/repository/redhat-cop/fc-asciidoctor](https://quay.io/repository/redhat-cop/fc-asciidoctor) via [GitHub Workflows](../../.github/workflows/fc-asciidoctor-publish.yaml). diff --git a/utilities/fc-asciidoctor/version.json b/utilities/fc-asciidoctor/version.json new file mode 100644 index 000000000..f1d9aa2c9 --- /dev/null +++ b/utilities/fc-asciidoctor/version.json @@ -0,0 +1 @@ +{"version":"v1.0.0"} diff --git a/utilities/ubi10-asciidoctor/.gitignore b/utilities/ubi10-asciidoctor/.gitignore new file mode 100644 index 000000000..a13633799 --- /dev/null +++ b/utilities/ubi10-asciidoctor/.gitignore @@ -0,0 +1 @@ +*.pdf diff --git a/utilities/ubi10-asciidoctor/Dockerfile b/utilities/ubi10-asciidoctor/Dockerfile new file mode 100644 index 000000000..18141e9e4 --- /dev/null +++ b/utilities/ubi10-asciidoctor/Dockerfile @@ -0,0 +1,98 @@ +#FROM registry.access.redhat.com/ubi10@sha256:0f2f2f06299954f2e50cea0c878c33b8490eaadfc27cdc2b50d181d6ab44c5a9 +FROM registry.access.redhat.com/ubi10/ruby-33@sha256:14280dc6a535e2784d82525376a9c1b19f88f47ef9c05cdb2f707fc120718443 + + +LABEL MAINTAINERS="Red Hat Services" + +ARG ARCH=amd64 +ARG RUBY_VERSION=3.3 +ARG asciidoctor_version=2.0.23 +ARG asciidoctor_confluence_version=0.0.2 +ARG asciidoctor_pdf_version=2.3.19 +ARG asciidoctor_diagram_version=2.3.2 +ARG asciidoctor_epub3_version=2.2.0 +ARG asciidoctor_mathematical_version=0.3.5 +ARG asciidoctor_revealjs_version=5.2.0 +ARG kramdown_asciidoc_version=2.1.0 +ARG asciidoctor_bibtex_version=0.9.0 +ARG pandoc_version=3.7.0.2 +ARG asciidoctor_reducer_version=1.1.2 +ARG epubcheck_ruby_version=5.2.1.0 + +ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \ + ASCIIDOCTOR_CONFLUENCE_VERSION=${asciidoctor_confluence_version} \ + ASCIIDOCTOR_PDF_VERSION=${asciidoctor_pdf_version} \ + ASCIIDOCTOR_DIAGRAM_VERSION=${asciidoctor_diagram_version} \ + ASCIIDOCTOR_EPUB3_VERSION=${asciidoctor_epub3_version} \ + ASCIIDOCTOR_MATHEMATICAL_VERSION=${asciidoctor_mathematical_version} \ + ASCIIDOCTOR_REVEALJS_VERSION=${asciidoctor_revealjs_version} \ + KRAMDOWN_ASCIIDOC_VERSION=${kramdown_asciidoc_version} \ + ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version} \ + PANDOC_VERSION=${pandoc_version} \ + ASCIIDOCTOR_REDUCER_VERSION=${asciidoctor_reducer_version} \ + EPUBCHECK_RUBY_VERSION=${epubcheck_ruby_version} + +USER root + +#RUN dnf -y module enable ruby:${RUBY_VERSION} && \ +# dnf -y module install ruby:${RUBY_VERSION} + +RUN dnf install -y \ + python3-devel \ + git \ + make \ + gcc \ + redhat-rpm-config \ + ruby-devel \ + zlib-devel \ + python3-lxml \ + libjpeg-turbo-devel \ + java-21-openjdk-headless \ + fontconfig \ + && gem install --no-document \ + "asciidoctor:${ASCIIDOCTOR_VERSION}" \ + "asciidoctor-confluence:${ASCIIDOCTOR_CONFLUENCE_VERSION}" \ + "asciidoctor-diagram:${ASCIIDOCTOR_DIAGRAM_VERSION}" \ + "asciidoctor-epub3:${ASCIIDOCTOR_EPUB3_VERSION}" \ + asciimath \ + "asciidoctor-pdf:${ASCIIDOCTOR_PDF_VERSION}" \ + "asciidoctor-revealjs:${ASCIIDOCTOR_REVEALJS_VERSION}" \ + coderay \ + epubcheck-ruby:${EPUBCHECK_RUBY_VERSION} \ + haml \ + "kramdown-asciidoc:${KRAMDOWN_ASCIIDOC_VERSION}" \ + rouge \ + slim \ + thread_safe \ + tilt \ + "asciidoctor-bibtex:${ASCIIDOCTOR_BIBTEX_VERSION}" \ + "asciidoctor-reducer:${ASCIIDOCTOR_REDUCER_VERSION}" \ + && rm -rf /usr/local/share/gems/cache \ + && dnf clean all \ + && rm -rf /var/lib/dnf + +# install pandoc +RUN curl -L https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-${ARCH}.tar.gz | tar xvz --strip-components 1 -C /usr/local/ pandoc-${PANDOC_VERSION}/bin/pandoc + +WORKDIR /documents +VOLUME /documents + +RUN mkdir /home/work \ + && chgrp -R 0 /home/work \ + && chmod -R g=u /home/work + +ENV HOME=/home/work + +# Installing Python dependencies for additional +# functionnalities as diagrams or syntax highligthing +RUN pip3 install --no-cache-dir \ + actdiag \ + 'blockdiag[pdf]' \ + 'nwdiag[pdf]' \ + seqdiag \ + lxml + +USER 1001 + +CMD ["/bin/bash"] + diff --git a/utilities/ubi10-asciidoctor/README.md b/utilities/ubi10-asciidoctor/README.md new file mode 100644 index 000000000..f4cda81b3 --- /dev/null +++ b/utilities/ubi10-asciidoctor/README.md @@ -0,0 +1,18 @@ +# ubi8-asciidoctor + +A utility image for the UBI8 image + asciidoctor. + +Contains the primary used asciidoctor-pdf for generating reports. + +It's base is from but now ubi based. + +## Purpose + +Useful for environments where these libraries/tools are needed such as: + +* local development +* CI tools that do not require specific CI tooling configuration, such as GiLab Jobs. + +## Published + +[https://quay.io/repository/redhat-cop/ubi8-asciidoctor](https://quay.io/repository/redhat-cop/ubi8-asciidoctor) via [GitHub Workflows](../../.github/workflows/ubi8-asciidoctor-publish.yaml). diff --git a/utilities/ubi10-asciidoctor/basic-example.adoc b/utilities/ubi10-asciidoctor/basic-example.adoc new file mode 100644 index 000000000..2da5c540f --- /dev/null +++ b/utilities/ubi10-asciidoctor/basic-example.adoc @@ -0,0 +1,39 @@ += Document Title +Doc Writer +:reproducible: +:listing-caption: Listing +:source-highlighter: rouge +:toc: +// Uncomment next line to add a title page (or set doctype to book) +//:title-page: +// Uncomment next line to set page size (default is A4) +//:pdf-page-size: Letter + +An example of a basic https://asciidoc.org[AsciiDoc] document prepared by {author}. + +== Introduction + +A paragraph followed by an unordered list{empty}footnote:[AsciiDoc supports unordered, ordered, and description lists.] with square bullets.footnote:[You may choose from square, disc, and circle for the bullet style.] + +[square] +* item 1 +* item 2 +* item 3 + +== Main + +Here's how you say "`Hello, World!`" in Prawn: + +.Create a basic PDF document using Prawn +[source,ruby] +---- +require 'prawn' + +Prawn::Document.generate 'example.pdf' do + text 'Hello, World!' +end +---- + +== Conclusion + +That's all, folks! diff --git a/utilities/ubi10-asciidoctor/changelog.md b/utilities/ubi10-asciidoctor/changelog.md new file mode 100644 index 000000000..e79640f89 --- /dev/null +++ b/utilities/ubi10-asciidoctor/changelog.md @@ -0,0 +1,38 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [Unreleased] + +### Added +- changelog.md + +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security + + +## [v3.0.0] - 2025-08-04 + + +## Added +- changelog.md +- basic-example.adoc +- local-test-steps.txt + +### Changed +- v2.2.1 is based on UBI8 +- v3.0.0 is based on ubi10/ruby-33 +- v3.0.0 has copied into directory ubi10-asciidoctor from ubi8-asciidoctor + + diff --git a/utilities/ubi10-asciidoctor/local-test-steps.txt b/utilities/ubi10-asciidoctor/local-test-steps.txt new file mode 100644 index 000000000..cfe7619c3 --- /dev/null +++ b/utilities/ubi10-asciidoctor/local-test-steps.txt @@ -0,0 +1,41 @@ + +CURRENT_IMAGE="quay.io/redhat-cop/ubi8-asciidoctor:v2.2.0" +TEST_IMAGE="ubi10-asciidoctor:latest" + + + +podman build -f Dockerfile -t "${TEST_IMAGE}" + + +# Generate PDF with current global available image +podman run \ + --userns=keep-id \ + --user="$(id -u):$(id -g)" \ + --rm \ + -v "$(PWD):/documents" \ + --name asciidoctor \ + ${CURRENT_IMAGE} \ + asciidoctor-pdf \ + -o basic-example-current.pdf \ + basic-example.adoc + + + +# Generate PDF with local created image +podman run \ + --userns=keep-id \ + --user="$(id -u):$(id -g)" \ + --rm \ + -v "$(PWD):/documents" \ + --name asciidoctor \ + ${TEST_IMAGE} \ + asciidoctor-pdf \ + -o basic-example-test.pdf \ + basic-example.adoc + +# Check if there are differences +## brew install diff-pdf + +diff-pdf -v basic-example-current.pdf basic-example-test.pdf + + diff --git a/utilities/ubi10-asciidoctor/version.json b/utilities/ubi10-asciidoctor/version.json new file mode 100644 index 000000000..719b6c831 --- /dev/null +++ b/utilities/ubi10-asciidoctor/version.json @@ -0,0 +1 @@ +{"version":"v3.0.0"} diff --git a/utilities/ubi8-asciidoctor/Dockerfile b/utilities/ubi8-asciidoctor/Dockerfile index f660acecf..13528018f 100644 --- a/utilities/ubi8-asciidoctor/Dockerfile +++ b/utilities/ubi8-asciidoctor/Dockerfile @@ -17,7 +17,6 @@ ARG pandoc_version=3.6.4 ARG asciidoctor_reducer_version=1.1.2 ARG epubcheck_ruby_version=5.2.1.0 - ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \ ASCIIDOCTOR_CONFLUENCE_VERSION=${asciidoctor_confluence_version} \ ASCIIDOCTOR_PDF_VERSION=${asciidoctor_pdf_version} \ @@ -94,3 +93,4 @@ RUN pip3 install --no-cache-dir \ USER 1001 CMD ["/bin/bash"] +