aboutsummaryrefslogtreecommitdiff
path: root/publish.sh
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-05-09 13:45:27 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-05-09 13:45:27 -0400
commit6b6940e59abba27c110ab33a68e5e11c5bd5962c (patch)
tree4f12eb3655207a291a938630bc62f46151fccb60 /publish.sh
downloaddocker-buildsys-py-6b6940e59abba27c110ab33a68e5e11c5bd5962c.tar.gz
Initial commit
Diffstat (limited to 'publish.sh')
-rwxr-xr-xpublish.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/publish.sh b/publish.sh
new file mode 100755
index 0000000..9a0fa45
--- /dev/null
+++ b/publish.sh
@@ -0,0 +1,32 @@
+PYTHON_VERSION=${PYTHON_VERSION:-}
+HUB=${HUB:-}
+
+if [[ -n ${1} ]]; then
+ PYTHON_VERSION=${1}
+fi
+
+if [[ -n ${2} ]]; then
+ HUB=${2}
+fi
+
+
+if [[ -z ${PYTHON_VERSION} ]]; then
+ echo "Missing python version (format: x.y.z)"
+ exit 1
+fi
+
+if [[ -z ${HUB} ]]; then
+ echo "Missing dockerhub repo (format: reponame)"
+ exit 1
+fi
+
+short_version=${PYTHON_VERSION/./}
+if [[ ${#short_version} < 2 ]]; then
+ echo "Python version is too short. Must be in x.y.z format"
+ exit 1
+fi
+short_version=${short_version:0:2}
+IMAGE="buildsys-py${short_version}"
+
+docker tag ${IMAGE} ${HUB}/${IMAGE}
+docker push ${HUB}/${IMAGE}