Skip to content

Docker Build

Docker Build #1

Workflow file for this run

name: Docker Build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
env:
IMAGE_NAME: hmpps-delius-alfresco-activemq
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v7.1.0
docker:
name: activemq ${{ matrix.activemq_base_version }}
strategy:
matrix:
base_image:
- flavor: rockylinux
major: 8
java_major:
- 17
jdist:
- jre
activemq_base_version:
- 5.16
- 5.17
- 5.18
env:
# Which activemq_base_version of the matrix should produce `latest` tag
ACTIVEMQ_LATEST_VERSION: 5.18
runs-on: ubuntu-latest
needs: pre-commit
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- id: vars
name: Compute vars
env:
ACTIVEMQ_BASE_VERSION: ${{ matrix.activemq_base_version }}
run: |
ACTIVEMQ_VERSION=$(jq -r .activemq_version versions/activemq-${ACTIVEMQ_BASE_VERSION}.json)
echo "activemq_version=$ACTIVEMQ_VERSION" >> $GITHUB_OUTPUT
echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
# QUAY_IMAGE_NAME="quay.io/${IMAGE_REGISTRY_NAMESPACE}/${IMAGE_REPOSITORY}"
# DOCKERHUB_IMAGE_NAME="${IMAGE_REGISTRY_NAMESPACE}/${IMAGE_REPOSITORY}"
GHCR_IMAGE_NAME="ghcr.io/${IMAGE_REGISTRY_NAMESPACE}/${IMAGE_REPOSITORY}"
TAG_COMMON_METADATA="${{ matrix.jdist }}${{ matrix.java_major }}-${{ matrix.base_image.flavor }}${{ matrix.base_image.major }}"
IMAGE_TAG_SEMVER="${ACTIVEMQ_VERSION}-${TAG_COMMON_METADATA}"
IMAGE_TAG_MINOR="${ACTIVEMQ_BASE_VERSION}-${TAG_COMMON_METADATA}"
echo "tags<<EOF" >> $GITHUB_OUTPUT
echo "ghcr.io/${{ github.repository_owner }}/${{ steps.meta.outputs.tags }}, ghcr.io/${{github.repository_owner }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG_SEMVER}" >> $GITHUB_OUTPUT
echo "ghcr.io/${{ github.repository_owner }}/${{ steps.meta.outputs.tags }}, ghcr.io/${{github.repository_owner }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG_MINOR}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.actor != 'dependabot[bot]' }}
build-args: |
ACTIVEMQ_VERSION=${{ steps.vars.outputs.activemq_version }}
JDIST=${{ matrix.jdist }}
DISTRIB_NAME=${{ matrix.base_image.flavor }}
DISTRIB_MAJOR=${{ matrix.base_image.major }}
JAVA_MAJOR=${{ matrix.java_major }}
REVISION=${{ github.run_number }}
CREATED=${{ steps.vars.outputs.image_created }}
tags: |
${{ steps.vars.outputs.tags }}
labels: |
${{ steps.vars.outputs.labels }}
provenance: false
target: ACTIVEMQ_IMAGE
platforms: linux/amd64,linux/arm64/v8