name: Build Docker Image
run-name: Build Docker Image 
on: [push]

jobs:
  Build Docker Image:
    runs-on: ubuntu-node
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - name: Build docker image
        run: |
          mv Dockerfile ../
          mv entrypoint ../
          cd ../
          set +e
          docker rm $(docker stop $(docker ps -a -q --filter ancestor=accounting-api:latest --format="{{.ID}}"))
          set -e
          docker image rm -f accounting-api:latest
          docker build . -t accounting-api:latest
  Restart Docker Compose:
    runs-on: host
    steps:
      - name: Restart compose project
        run: |
          echo '(cd backend-development-kickstarter && ddd && ddd && ddud)' > /hostpipe
          