Skip to content

Commit

Permalink
Fedora based asciidoctor
Browse files Browse the repository at this point in the history
  • Loading branch information
hdaems committed Oct 11, 2023
1 parent dc460b9 commit a37bef1
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/fc-asciidoctor-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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: Check and verify version.json
id: check_version
run: |
echo -n ::set-output name=IMAGE_TAGS::
echo $(jq -r '.version' ${context}/version.json)
- 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
49 changes: 49 additions & 0 deletions .github/workflows/fc-asciidoctor-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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
run: |
echo -n ::set-output name=IMAGE_TAGS::
VERSION=$(jq -r '.version' ${context}/version.json)
TAGS=('latest')
if [ "${VERSION}" ] && [ "${VERSION}" != "latest" ]; then
TAGS+=("${VERSION}")
fi
if [[ "${GITHUB_REF}" =~ refs/tags/(.*) ]]; then
TAGS+=("git-${BASH_REMATCH[1]}")
fi
echo "${TAGS[*]}"
- 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 }}
57 changes: 57 additions & 0 deletions utilities/fc-asciidoctor/.openshift/bc-fc-asciidoctor.yml
Original file line number Diff line number Diff line change
@@ -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

34 changes: 34 additions & 0 deletions utilities/fc-asciidoctor/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

17 changes: 17 additions & 0 deletions utilities/fc-asciidoctor/README.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions utilities/fc-asciidoctor/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"v1.0.0"}

0 comments on commit a37bef1

Please sign in to comment.