DevOps Classroom notes 24/Jul/2026

Workflow_call

name: docker_workflow

on: 
  workflow_call:
    inputs:
      dockerimage:
       default: spring
       type: string
       required: true
      DOCKERHUB_USERNAME:
        type: string
        default: ramqt2205
        required: true
jobs:
  build_and_publish:
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0

      - name: install docker
        uses: docker/setup-buildx-action@v4

      - name:  login dockerhub
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PAT }}

      - name: buid and publish image main
        if: ${{ github.ref_name == 'main' }}
        uses: docker/build-push-action@v7
        with:
          push: true
          tags: ${{ inputs.DOCKERHUB_USERNAME }}/${{ inputs.dockerimage }}:${{ github.run_number }}

      - name: buid and publish image main
        if: ${{ github.ref_name != 'main' }}
        uses: docker/build-push-action@v7
        with:
          push: true
          tags: ${{ inputs.DOCKERHUB_USERNAME }}/${{ inputs.dockerimage }}-snapshot:${{ github.run_number }}

Call workflow

name: call docker workflow

on:
  push:
    branches: '*'

jobs:
  call-docker-build:
    uses: direct-devops/actions/.github/workflows/docker.yaml@main
    with:
      dockerimage: spring-petclinic # ${{ github.repository.name }}
      DOCKERHUB_USERNAME: ramqt2205
    secrets: inherit

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube