version: 2

defaults:

  container: &default_container
    working_directory: ~/build
    docker:
      - image: circleci/openjdk:8-jdk

  release_filter: &release_filter
    filters:
      tags:
        only: /.*/


jobs:

  build_and_deploy_image:
     <<: *default_container
     steps:
       - checkout
       - setup_remote_docker:
           version: 17.05.0-ce
       - run:
           name: Build and deploy docker image
           command: |
             docker build -t build/kafka-namager -f ./Dockerfile ./
             docker login -u $DOCKER_USER -p $DOCKER_PASS
             docker tag build/kafka-namager hlebalbau/kafka-namager:$CIRCLE_TAG
             docker push hlebalbau/kafka-namager:$CIRCLE_TAG
             docker tag build/cm-stream-api hlebalbau/kafka-namager:latest
             docker push hlebalbau/kafka-namager:latest


workflows:
  version: 2

  build_and_deploy_image:
    jobs:
      - build_and_deploy_image:
          <<: *release_filter
version: 2

defaults:

  container: &default_container
    working_directory: ~/build
    docker:
      - image: circleci/openjdk:8-jdk

  release_filter: &release_filter
    filters:
      tags:
        only: /.*/
      branches:
        ignore: /.*/


jobs:

  build_and_deploy_image:
     <<: *default_container
     steps:
       - checkout
       - setup_remote_docker:
           version: 17.05.0-ce
       - run:
           name: Build and deploy docker image
           command: |
             docker build -t build/kafka-namager -f ./Dockerfile ./
             docker login -u $DOCKER_USER -p $DOCKER_PASS
             docker tag build/kafka-namager hlebalbau/kafka-namager:$CIRCLE_TAG
             docker push hlebalbau/kafka-namager:$CIRCLE_TAG
             docker tag build/cm-stream-api hlebalbau/kafka-namager:latest
             docker push hlebalbau/kafka-namager:latest


workflows:
  version: 2

  build_and_deploy_image:
    jobs:
      - build_and_deploy_image:
          <<: *release_filter
Fix circle ci release filter
Fix circle ci release filter

run image script only for releases
