docker-image.yml update

This commit is contained in:
ChrispyBacon-dev 2025-05-28 14:59:21 +02:00
parent f553cd5a3f
commit a8643e756f
2 changed files with 24 additions and 25 deletions

View file

@ -1,26 +1,14 @@
# DockFlare: Automates Cloudflare Tunnel ingress from Docker labels.
# Copyright (C) 2025 ChrispyBacon-Dev <https://github.com/ChrispyBacon-dev/DockFlare>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# .github/docker-image.yml
name: Docker Image Build and Push (Conditional Arch)
name: Docker Image Build and Push
on:
push:
branches:
- "stable"
- "unstable"
- "stable" # For 'latest' and 'stable' tags
- "unstable" # For 'unstable' tag
tags:
- "v*.*.*" # Trigger on semantic version tags like v1.2.3
- "v*.*.*-*" # Trigger on pre-release semver tags like v1.2.3-beta.1
pull_request:
branches:
- "stable"
@ -44,6 +32,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@ -55,17 +44,27 @@ jobs:
with:
images: alplat/dockflare
tags: |
# For Git tags like v1.2.3 -> image tag 1.2.3
type=semver,pattern={{version}}
type=ref,event=branch,pattern=stable,value=latest
# For Git tags like v1.2.3-beta.1 -> image tag 1.2.3-beta.1
type=semver,pattern={{version}},suffix=-{{premajor}}-{{prerelease}}
# For stable branch -> image tag 'latest' and 'stable' (if you want 'stable' too)
type=ref,event=branch,pattern=stable,value=latest
type=ref,event=branch,pattern=stable,value=stable # Optional: if you want an explicit 'stable' tag
# For unstable branch -> image tag 'unstable'
type=ref,event=branch,pattern=unstable,value=unstable
type=sha,format=short
# For all pushes, create a SHA tag
type=sha,format=short
# Add a tag for the Git ref (branch name or tag name) itself
type=ref,event=tag
type=ref,event=branch
- name: Build and Push Docker Image (Multi-Arch)
- name: Build and Push Docker Image
id: build_and_push
uses: docker/build-push-action@v5
with:
context: ./dockflare
platforms: linux/amd64 #,linux/arm64
push: ${{ github.event_name == 'push' && (github.ref_name == 'stable' || github.ref_name == 'unstable') }}
platforms: ${{ (github.ref_name == 'unstable' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-'))) && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}