name: Publish Docker Image Development

on:
  push:
    branches: ['development']
  pull_request:
    branches: ['development']

jobs:
  build:
    runs-on: ubuntu-latest
    if: ${{github.event.head_commit.message}} == *'build image'*

    steps:
      - name: Docker Hub Login
        env:
          DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
          DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
        run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

      - uses: actions/checkout@v3
      - name: Build the Docker image
        run: |
          docker build . --file Dockerfile --tag defuj/apkt-eis:v0.0.10-vm
          docker push defuj/apkt-eis:v0.0.10-vm
