Bump docker/setup-qemu-action in the github-actions group #272
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build images | |
on: | |
push: | |
paths: | |
- 'Dockerfile' | |
- '.dockerignore' | |
- '.github/workflows/main.yml' | |
schedule: | |
- cron: '12 2 * * MON' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name || github.run_id }} | |
cancel-in-progress: true | |
env: | |
IMAGE_REGISTRY_NAMESPACE: alfresco | |
IMAGE_REPOSITORY: alfresco-base-java | |
jobs: | |
build: | |
name: Java ${{ matrix.java_major }} on ${{ matrix.base_image.flavor }}:${{ matrix.base_image.major }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: ${{ github.ref_name == 'master' && false || true }} | |
matrix: | |
base_image: | |
- flavor: rockylinux | |
major: 8 | |
- flavor: rockylinux | |
major: 9 | |
java_major: | |
- 11 | |
- 17 | |
jdist: | |
- jre | |
exclude: | |
- base_image: | |
flavor: rockylinux | |
major: 9 | |
java_major: 11 | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0 | |
- id: vars | |
name: Compute Image Tag | |
env: | |
IMAGE_BASE_NAME: ${{ matrix.jdist }}${{ matrix.java_major }}-${{ matrix.base_image.flavor }}${{ matrix.base_image.major }} | |
run: | | |
if [[ "${{ github.ref_name }}" == "master" ]]; then | |
echo "image_tag=$IMAGE_BASE_NAME" >> $GITHUB_OUTPUT | |
echo "image_labels=" >> $GITHUB_OUTPUT | |
else | |
echo "image_tag=${IMAGE_BASE_NAME}-${GITHUB_REF_NAME//\//-}" >> $GITHUB_OUTPUT | |
echo "image_labels=quay.expires-after=2w" >> $GITHUB_OUTPUT | |
fi | |
echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
- name: Login to quay.io | |
if: github.actor != 'dependabot[bot]' | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Login to docker.io | |
if: github.ref_name == 'master' | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Image locally | |
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 | |
with: | |
load: true | |
build-args: | | |
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: | | |
local/${{ env.IMAGE_REPOSITORY }}:ci | |
target: JAVA_BASE_IMAGE | |
- name: Test Built Image | |
run: | | |
echo -n "Checking for java version: " | |
docker run local/${{ env.IMAGE_REPOSITORY }}:ci java -version 2>&1 \ | |
| grep -i 'version \"${{ matrix.java_major }}\.' | |
echo -n "Checking shell environment: " | |
BASH_LOGIN="$(docker run local/${{ env.IMAGE_REPOSITORY }}:ci /bin/bash 2>&1 > /dev/null || true)" | |
if [ -z "$BASH_LOGIN" ]; then | |
echo ok | |
else echo 'bash reported an error' | |
echo $BASH_LOGIN | |
exit 7 | |
fi | |
- name: Build and Push to quay.io | |
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0 | |
with: | |
push: ${{ github.actor != 'dependabot[bot]' }} | |
build-args: | | |
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: | | |
quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} | |
platforms: linux/amd64,linux/arm64/v8 | |
labels: ${{ steps.vars.outputs.image_labels }} | |
provenance: false | |
target: JAVA_BASE_IMAGE | |
- name: Push Image to docker.io | |
if: github.ref_name == 'master' | |
env: | |
SRC_IMAGE: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} | |
DST_IMAGE: ${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} | |
run: | | |
docker buildx imagetools create ${{ env.SRC_IMAGE }} -t ${{ env.DST_IMAGE }} |