version: 2.1
jobs:
  release:
    docker:
      - image: cimg/base:2022.09
        auth:
          username: $DOCKERHUB_USERNAME
          password: $DOCKERHUB_PASSWORD
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Build and Push application Docker image
          command: |
            echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
            cd build && make release
workflows:
  release:
    jobs:
      - release:
          filters:
            branches:
              only: main