Skip to content

Instantly share code, notes, and snippets.

@eggplants
Created October 29, 2025 14:06
Show Gist options
  • Save eggplants/55fb5c373ddcebba20004e8c2a213c61 to your computer and use it in GitHub Desktop.
Save eggplants/55fb5c373ddcebba20004e8c2a213c61 to your computer and use it in GitHub Desktop.
minio
name: Build and Push Docker Images
on:
push:
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Extract release version
id: release
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
RELEASE=${{ steps.release.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment