Files
phpmyadmin-docker-lightweight/.github/workflows/callable-build-docker-image.yml
T

61 lines
1.9 KiB
YAML

# Alexander Tebiev - https://github.com/beeyev
on:
workflow_call:
inputs:
DOCKER_REGISTRY_IMAGE:
required: true
type: string
DOCKERFILE_PATH:
required: true
type: string
BASE_IMAGE_VERSION:
required: true
type: string
jobs:
build-docker-image:
name: Build Docker Image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout branch - ${{ github.head_ref || github.ref_name }}
uses: actions/checkout@v4
- name: Prepare Build Env Variables
uses: ./.github/actions/prepare-env-variables/
id: prepare-build-env-variables
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Build image and push to registry - ${{ inputs.DOCKER_REGISTRY_IMAGE }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: .
file: ${{ inputs.DOCKERFILE_PATH }}
cache-from: type=registry,ref=${{ inputs.DOCKER_REGISTRY_IMAGE }}
cache-to: type=inline
build-args: |
BASE_IMAGE_VERSION=${{ inputs.BASE_IMAGE_VERSION }}
BUILD_DATE=${{ steps.prepare-build-env-variables.outputs.BUILD_DATE }}
BUILD_FINGERPRINT=${{ steps.prepare-build-env-variables.outputs.BUILD_FINGERPRINT }}
BRANCH_NAME=${{ steps.prepare-build-env-variables.outputs.CURRENT_BRANCH_NAME }}
tags: ${{ inputs.DOCKER_REGISTRY_IMAGE }}
push: true