Skip to content

feat: allow different Dockerfile for each version #134

feat: allow different Dockerfile for each version

feat: allow different Dockerfile for each version #134

Workflow file for this run

name: 'Build solr docker image'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: 0 7 * * THU
push:
branches:
- main
paths:
- solr/**
- .github/workflows/solr.yml
- .github/action/dockerfile-finder/**
pull_request:
branches:
- main
paths:
- solr/**
- .github/workflows/solr.yml
- .github/action/dockerfile-finder/**
workflow_dispatch:
inputs: {}
jobs:
version-matrix:
name: 'Generate version-matrix'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.version-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: ./.github/action/endoflife
id: version-matrix
with:
product: 'solr'
- name: Show matrix output
env:
MATRIX: ${{ steps.version-matrix.outputs.matrix }}
run: echo "$MATRIX"
build-docker-image:
name: 'Build solr-${{ matrix.image.name }} docker image'
needs: version-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
image: ${{ fromJson(needs.version-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: find Dockerfile
uses: ./.github/action/dockerfile-finder
id: dockerfile
with:
path: ./solr
version: ${{ matrix.image.version }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v4
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v4.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (solr)
uses: docker/build-push-action@v7
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./solr
target: solr
file: ./solr/${{ steps.dockerfile.outputs.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/netlogix/docker/solr:${{ matrix.image.name }}
ghcr.io/netlogix/docker/solr:${{ matrix.image.version }}
build-args: |
SOLR_VERSION=${{ matrix.image.version }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha, scope=${{ github.workflow }}-solr-${{ matrix.image.name }}
cache-to: type=gha, scope=${{ github.workflow }}-solr-${{ matrix.image.name }}, mode=max