version: 2.1

orbs:
  base: dmx-io/base@2.0.88

jobs:
  build_and_push:
    working_directory: /app
    docker:
      - image: docker:17.09.0-ce-git
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Install dependencies
          command: |
            apk update
            apk upgrade
            apk add --no-cache make
      - run:
          name: Build application Docker image
          command: |
            make docker-build
      - deploy:
          name: Push Docker image to Docker Hub
          command: |
            make docker-login-ci
            make docker-tag-ci
            make docker-push-ci

workflows:
  main:
    jobs:
      - build_and_push:
          filters:
            branches:
              only:
                - master
                - develop
              ignore: /.*/
