Skip to content

Docker Image Build & Deploy #135

Docker Image Build & Deploy

Docker Image Build & Deploy #135

Workflow file for this run

name: Docker Image Build & Deploy
on:
release:
types: [created]
workflow_dispatch:
inputs:
version:
description: 'Version number for the Docker image'
required: true
default: 'latest'
jobs:
build:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: micrib/mqdockerup
# Conditional tag logic based on the event that triggered the workflow
tags: |
type=raw,value=${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.event_name == 'workflow_dispatch' && github.event.inputs.version }},enable=true
type=raw,value=latest,enable=true
type=sha
flavor: |
latest=false
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}