Skip to content

Docker Image CI/CD for number versions #4

Docker Image CI/CD for number versions

Docker Image CI/CD for number versions #4

name: Docker Image CI/CD for number versions
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
strategy:
matrix:
dockerfile:
[
"Dockerfile.13",
"Dockerfile.14",
"Dockerfile.15",
"Dockerfile.16",
"Dockerfile.17",
]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from Dockerfile name
id: extract_version
run: |
version="${{ matrix.dockerfile }}"
version="${version#Dockerfile.}" # Remove "Dockerfile." prefix if it exists
echo "version=${version}" >> $GITHUB_OUTPUT
shell: bash
- name: Build and Publish
uses: docker/build-push-action@v5
with:
file: ${{ matrix.dockerfile }}
platforms: linux/arm64, linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.extract_version.outputs.version }}