summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-02-07 10:14:58 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-02-07 10:14:58 -0500
commitb0fa760126571f7fd22e1dfa7ee641b195639efc (patch)
tree96eeb308c62bfdab9e127a4a1e78bbc92e72e8c8 /build.sh
parentdc6b09f58d2a4287bdea5ae2197944a9e93c56c8 (diff)
downloaddocker-python-b0fa760126571f7fd22e1dfa7ee641b195639efc.tar.gz
Dynamic base version
Use LATEST file to denote which version becomes "latest" tag
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 8d9848a..0e8e3c2 100755
--- a/build.sh
+++ b/build.sh
@@ -6,4 +6,19 @@ if [[ -z ${PYTHON_VERSION} ]]; then
exit 1
fi
-docker build -t ${PROJECT}:${PYTHON_VERSION} --build-arg PYTHON_VERSION=${PYTHON_VERSION} .
+BASE_VERSION="${2}"
+if [[ -z ${BASE_VERSION} ]]; then
+ BASE_VERSION="latest"
+fi
+
+is_tag_latest=$([[ -f LATEST ]] && [[ $(<LATEST) == ${PYTHON_VERSION} ]] && echo yes)
+if [[ -n ${is_tag_latest} ]]; then
+ tag_latest="-t ${PROJECT}:latest"
+fi
+
+
+docker build -t ${PROJECT}:${PYTHON_VERSION} \
+ ${tag_latest} \
+ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \
+ --build_arg BASE_VERSION=${BASE_VERSION} \
+ .