Skip to content

Commit

Permalink
mod. GitHub w/flow: automatic/ly push imgs.
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-ling committed Jun 28, 2024
1 parent eda7857 commit d30b7ff
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,28 @@
name: Build and push Docker image

on:
workflow_dispatch:
inputs:
platforms:
description: platforms to build for
type: string
default: linux/amd64,linux/arm64/v8
required: false
image-name:
description: a base name for image tags
type: string
default: lightningstream
required: false
image-tags:
description: image tags
type: string
default: type=semver,pattern={{version}}
required: false
push:
description: push image to Docker Hub
type: boolean
required: true
secrets:
DOCKERHUB_ORGANIZATION_NAME:
required: true
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

permissions:
contents: read # principle of least privilege

jobs:
build:
name: Build Docker image
name: Build and push Docker image
runs-on: ubuntu-22.04
env:
PLATFORMS: linux/amd64,linux/arm64/v8
IMAGE_NAME: lightningstream
IMAGE_TAGS: type=semver,pattern={{version}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx for multi-platform builds
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ inputs.platforms }}
platforms: ${{ env.PLATFORMS }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -54,12 +33,12 @@ jobs:
uses: docker/metadata-action@v5
with:
images: >-
${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ inputs.image-name }}
tags: ${{ inputs.image-tags }}
${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAGS }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: ${{ inputs.platforms }}
push: ${{ inputs.push }}
platforms: ${{ env.PLATFORMS }}
push: true
sbom: true
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}

0 comments on commit d30b7ff

Please sign in to comment.