neko/.github/workflows/image_app.yml
Miroslav Šedivý dfc2e5505c update names.
2025-03-30 18:30:05 +02:00

73 lines
2.1 KiB
YAML

name: Build App Image
on:
workflow_call:
inputs:
name:
required: true
type: string
description: "The name of the app to build."
flavor:
required: false
type: string
default: ""
description: "The flavor of the image to build."
platforms:
required: false
type: string
default: "linux/amd64"
description: "The platforms to build for."
dockerfile:
required: false
type: string
default: "Dockerfile"
description: "The Dockerfile to use for building the image."
env:
FLAVOR_PREFIX: ${{ inputs.flavor && format('{0}-', inputs.flavor) || '' }}
jobs:
build-app:
name: Build App Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ inputs.name }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,format=long
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_ACCESS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: apps/${{ inputs.name }}
file: apps/${{ inputs.name }}/${{ inputs.dockerfile || 'Dockerfile' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }}
platforms: ${{ inputs.platforms || 'linux/amd64' }}