From 0cdde70049a9d110ff21a4465a9b801289d55201 Mon Sep 17 00:00:00 2001
From: Rub21 <rub2106@gmail.com>
Date: Fri, 1 Jun 2018 09:24:40 -0500
Subject: [PATCH 1/3] add test and push into docker hub

---
 .circleci/config.yml | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 .circleci/config.yml

diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..b607c4e
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,43 @@
+version: 2
+jobs:
+  web:
+    docker:
+      - image: docker:17.05.0-ce-git
+    steps:
+      - checkout
+      - setup_remote_docker
+
+      - restore_cache:
+          keys:
+            - v1-{{ .Branch }}
+          paths:
+            - caches/tensorflowbd.tar
+
+      - run:
+          name: Load docker image cache
+          command: |
+            docker load -i caches/tensorflowbd.tar || true
+
+      - run:
+          name: Build application docker image
+          command: docker build --cache-from=tensorflowbd -t web tensorflow-building-detection/
+          no_output_timeout: 60m
+
+      - run:
+          name: Save docker image cache
+          command: |
+            mkdir -p caches
+            docker save -o caches/tensorflowbd.tar tensorflowbd
+
+      - save_cache:
+          key: v1-{{ .Branch }}-{{ epoch }}
+          paths:
+            - caches/tensorflowbd.tar
+
+      - deploy:
+         name: Push docker image
+         command: |
+          VERSION=$(grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g')
+          docker tag web rub21/tensorflow-building-detection:${VERSION}
+          docker login -u $DOCKER_USER -p $DOCKER_PASS
+          docker push rub21/tensorflow-building-detection:${VERSION}
\ No newline at end of file

From 61ee069a724e63759c9abcdc0868375809d0cc93 Mon Sep 17 00:00:00 2001
From: Rub21 <rub2106@gmail.com>
Date: Fri, 1 Jun 2018 09:27:44 -0500
Subject: [PATCH 2/3] add package

---
 .circleci/config.yml | 2 +-
 package.json         | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
 create mode 100644 package.json

diff --git a/.circleci/config.yml b/.circleci/config.yml
index b607c4e..68ad9b1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -20,7 +20,7 @@ jobs:
 
       - run:
           name: Build application docker image
-          command: docker build --cache-from=tensorflowbd -t web tensorflow-building-detection/
+          command: docker build --cache-from=tensorflowbd -t web .
           no_output_timeout: 60m
 
       - run:
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a8908f6
--- /dev/null
+++ b/package.json
@@ -0,0 +1,3 @@
+{
+    "version": "0.0.1"
+}
\ No newline at end of file

From 8b15a947061e246e6564f9a7a8058b574c4ce0d1 Mon Sep 17 00:00:00 2001
From: Rub21 <rub2106@gmail.com>
Date: Fri, 1 Jun 2018 09:31:34 -0500
Subject: [PATCH 3/3] fix

---
 .circleci/config.yml | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 68ad9b1..a8774b1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,6 +1,6 @@
 version: 2
 jobs:
-  web:
+  tensorflow-building-detection:
     docker:
       - image: docker:17.05.0-ce-git
     steps:
@@ -20,7 +20,7 @@ jobs:
 
       - run:
           name: Build application docker image
-          command: docker build --cache-from=tensorflowbd -t web .
+          command: docker build --cache-from=tensorflowbd -t tensorflow-building-detection .
           no_output_timeout: 60m
 
       - run:
@@ -38,6 +38,11 @@ jobs:
          name: Push docker image
          command: |
           VERSION=$(grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g')
-          docker tag web rub21/tensorflow-building-detection:${VERSION}
+          docker tag tensorflow-building-detection rub21/tensorflow-building-detection:${VERSION}
           docker login -u $DOCKER_USER -p $DOCKER_PASS
-          docker push rub21/tensorflow-building-detection:${VERSION}
\ No newline at end of file
+          docker push rub21/tensorflow-building-detection:${VERSION}
+workflows:
+  version: 2
+  build_and_push:
+    jobs:
+      - tensorflow-building-detection
\ No newline at end of file