Create docker-image.yml

Signed-off-by: tim-hiiro <167431698+tim-hiiro@users.noreply.github.com>
This commit is contained in:
tim-hiiro 2025-04-10 18:31:40 +02:00 committed by GitHub
parent cc329358fe
commit ef5c97ffc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

58
.github/workflows/docker-image.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: publish Docker image
on:
pull_request:
types:
- closed
branches:
- "main"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_push_image:
name: Push Docker image to GitHub Packages
if: ${{ github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./standalone/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:1.0.${{ github.run_number }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max