name: 'Docker base image'
# act -j build -W ./.github/workflows/docker-base.yaml --secret-file  .dockerhub.secrets

on:
    workflow_dispatch:
    schedule:
      - cron: "0 4 5 * *" # build on the 5th of every month

jobs:
    build:
        strategy:
            matrix:
                server: [ fpm, apache ]
        runs-on: ubuntu-latest

        steps:

            - name: Checkout code
              uses: actions/checkout@v4

            - name: Install buildx
              uses: docker/setup-buildx-action@v3

            - name: Login to DockerHub
              uses: docker/login-action@v3
              with:
                  username: ${{secrets.DOCKERHUB_USERNAME}}
                  password: ${{secrets.DOCKERHUB_PASSWORD}}

            - name: Build
              uses: docker/build-push-action@v5
              with:
                  context: .docker
                  file: .docker/Dockerfile.kimai-base
                  build-args: |
                      TIMEZONE=Europe/London
                      BASE=${{ matrix.server }}
                  platforms: linux/amd64,linux/arm64 #,linux/arm/v8,linux/arm/v7,linux/arm/v6
                  tags: |
                    kimai/kimai-base:${{ matrix.server }}
                  push: true


