Skip to content

Docker 25.12 | push=true | latest=true #3

Docker 25.12 | push=true | latest=true

Docker 25.12 | push=true | latest=true #3

name: Publish Docker Images
on:
workflow_dispatch:
inputs:
version:
description: 'Version tag for docker images (e.g. 25.12)'
required: true
type: string
push:
description: 'Push images to Docker Hub'
required: true
type: boolean
default: false
latest:
description: 'Also tag openjdk18-bullseye-spring as latest'
required: true
type: boolean
default: false
run-name: "Docker ${{ inputs.version }} | push=${{ inputs.push }} | latest=${{ inputs.latest }}"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
framework: [spring, dropwizard]
jdk: [openjdk8, openjdk11, openjdk18]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ inputs.push }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set context directory
id: ctx
run: |
if [ "${{ matrix.framework }}" = "spring" ]; then
echo "dir=Demos/Spring" >> "$GITHUB_OUTPUT"
else
echo "dir=Demos/Dropwizard" >> "$GITHUB_OUTPUT"
fi
- name: Determine tags
id: tags
run: |
TAG="groupdocs/viewer:${{ inputs.version }}-java-${{ matrix.jdk }}-bullseye-${{ matrix.framework }}"
TAGS="${TAG}"
if [ "${{ inputs.latest }}" = "true" ] && [ "${{ matrix.framework }}" = "spring" ] && [ "${{ matrix.jdk }}" = "openjdk18" ]; then
TAGS="${TAGS},groupdocs/viewer:latest"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ${{ steps.ctx.outputs.dir }}
file: ${{ steps.ctx.outputs.dir }}/docker/Dockerfile-${{ matrix.jdk }}-bullseye
push: ${{ inputs.push }}
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max