130 lines
4.7 KiB
YAML
130 lines
4.7 KiB
YAML
name: Docker Publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*' # Trigger on version tags like v1.0.0
|
|
workflow_dispatch: # Allow manual trigger
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read # To read repository content
|
|
packages: write # To push packages to GitHub Container Registry
|
|
|
|
env:
|
|
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_ORGNAME }}
|
|
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: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta # Giving an ID to this step to reference its outputs later
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: | # Define base image names for metadata generation
|
|
orion-visor-adminer
|
|
orion-visor-guacd
|
|
orion-visor-mysql
|
|
orion-visor-redis
|
|
orion-visor-service
|
|
orion-visor-ui
|
|
tags: | # Define how tags are generated
|
|
type=semver,pattern={{version}} # Main strategy: git tag v1.2.3 will produce tag 1.2.3
|
|
type=semver,pattern={{major}}.{{minor}} # e.g., v1.2.3 -> 1.2
|
|
type=semver,pattern={{major}} # e.g., v1.2.3 -> 1
|
|
|
|
# --- Build and push generic images ---
|
|
|
|
- name: Build and push orion-visor-adminer
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/adminer/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/orion-visor-adminer:${{ steps.meta.outputs.version }}
|
|
ghcr.io/${{ github.repository_owner }}/orion-visor-adminer:${{ steps.meta.outputs.version }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Build and push orion-visor-guacd
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/guacd/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/orion-visor-guacd:${{ steps.meta.outputs.version }}
|
|
ghcr.io/${{ github.repository_owner }}/orion-visor-guacd:${{ steps.meta.outputs.version }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Build and push orion-visor-mysql
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/mysql/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/orion-visor-mysql:${{ steps.meta.outputs.version }}
|
|
ghcr.io/${{ github.repository_owner }}/orion-visor-mysql:${{ steps.meta.outputs.version }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Build and push orion-visor-redis
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/redis/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/orion-visor-redis:${{ steps.meta.outputs.version }}
|
|
ghcr.io/${{ github.repository_owner }}/orion-visor-redis:${{ steps.meta.outputs.version }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Build and push orion-visor-service
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/service/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/orion-visor-service:${{ steps.meta.outputs.version }}
|
|
ghcr.io/${{ github.repository_owner }}/orion-visor-service:${{ steps.meta.outputs.version }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Build and push orion-visor-ui
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/ui/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/orion-visor-ui:${{ steps.meta.outputs.version }}
|
|
ghcr.io/${{ github.repository_owner }}/orion-visor-ui:${{ steps.meta.outputs.version }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64 # Uncomment for multi-platform builds
|