20250122 ddm custom declarations #1682
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Docker | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
docker: | |
strategy: | |
matrix: | |
app_env: ["dev", "aws", "gcp"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
labels: | | |
org.opencontainers.image.title=Zentral | |
org.opencontainers.image.vendor=Zentral Pro Services GmbH | |
images: | | |
name=zentralopensource/zentral,enable=${{ matrix.app_env == 'dev' }} | |
name=zentralopensource/zentral-aws,enable=${{ matrix.app_env == 'aws' }} | |
name=zentralopensource/zentral-gcp,enable=${{ matrix.app_env == 'gcp' }} | |
flavor: | | |
latest=false | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=sha | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.app_env == 'dev' }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
APP_ENV=${{ matrix.app_env }} | |
APP_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |