From 2b7fe938139b798fc6fd8f5e939c44e21ece7455 Mon Sep 17 00:00:00 2001
From: Casey Kuhlman <casey@erisindustries.com>
Date: Thu, 24 Sep 2015 17:53:34 +0200
Subject: [PATCH] eris/erisdb -> quay.io/eris/erisdb; add a version file

---
 DOCKER/Dockerfile  |  2 +-
 DOCKER/build.sh    | 32 +++++++++++++++++---------------
 circle.yml         | 11 +++--------
 version/version.go |  3 +++
 4 files changed, 24 insertions(+), 24 deletions(-)
 create mode 100644 version/version.go

diff --git a/DOCKER/Dockerfile b/DOCKER/Dockerfile
index 67f488af..844f3ddc 100644
--- a/DOCKER/Dockerfile
+++ b/DOCKER/Dockerfile
@@ -92,4 +92,4 @@ ENV TMROOT /home/$USER/.eris/blockchains/tendermint
 EXPOSE 1337
 EXPOSE 46656
 EXPOSE 46657
-ENTRYPOINT ["erisdb-wrapper"]
+CMD "erisdb-wrapper"
diff --git a/DOCKER/build.sh b/DOCKER/build.sh
index 819eebf9..996dbc5b 100755
--- a/DOCKER/build.sh
+++ b/DOCKER/build.sh
@@ -1,26 +1,28 @@
 #!/bin/sh
 
-release_maj="0.10"
-release_min="0.10.3"
+if [ "$CIRCLE_BRANCH" ]
+then
+  repo=`pwd`
+else
+  base=github.com/eris-ltd/eris-db
+  repo=$GOPATH/src/$base
+fi
+branch=${CIRCLE_BRANCH:=master}
+
+release_min=$(cat $repo/version/version.go | tail -n 1 | cut -d \  -f 4 | tr -d '"')
+release_maj=$(echo $release_min | cut -d . -f 1-2)
 
 start=`pwd`
-branch=${ERISDB_BUILD_BRANCH:=master}
-base=github.com/eris-ltd/eris-db
-repo=$GOPATH/src/$base
+image_base=quay.io/eris/erisdb
 
 cd $repo
 
-# if [ "$DEV" != "true" ]; then
-# 	git checkout $branch
-# 	git pull origin
-# fi
-
-if [ "$ERISDB_BUILD_BRANCH" = "master" ]; then
-  docker build -t eris/erisdb:latest -f DOCKER/Dockerfile .
-  docker tag -f eris/erisdb:latest eris/erisdb:$release_maj
-  docker tag -f eris/erisdb:latest eris/erisdb:$release_min
+if [ "$branch" = "master" ]; then
+  docker build -t $image_base:latest -f DOCKER/Dockerfile .
+  docker tag -f $image_base:latest $image_base:$release_maj
+  docker tag -f $image_base:latest $image_base:$release_min
 else
-  docker build -t eris/erisdb:$branch -f DOCKER/Dockerfile .
+  docker build -t $image_base:$branch -f DOCKER/Dockerfile .
 fi
 
 cd $start
diff --git a/circle.yml b/circle.yml
index db98814f..61f77c31 100644
--- a/circle.yml
+++ b/circle.yml
@@ -26,11 +26,6 @@ deployment:
   master:
     branch: master
     commands:
-      - "export ERISDB_BUILD_BRANCH=$CIRCLE_BRANCH && DOCKER/build.sh"
-      - docker push eris/erisdb:latest
-      - docker push eris/erisdb:0.10
-  develop:
-    branch: develop
-    commands:
-      - "export ERISDB_BUILD_BRANCH=$CIRCLE_BRANCH && DOCKER/build.sh"
-      - docker push eris/erisdb:develop
+      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS quay.io
+      - DOCKER/build.sh
+      - docker push quay.io/eris/erisdb
diff --git a/version/version.go b/version/version.go
new file mode 100644
index 00000000..2deaf3ad
--- /dev/null
+++ b/version/version.go
@@ -0,0 +1,3 @@
+package version
+
+const VERSION = "0.10.4"
-- 
GitLab