summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile3
-rw-r--r--LATEST1
-rwxr-xr-xbuild.sh17
3 files changed, 19 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index d03e3e9..55a4ee0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,5 @@
-FROM astroconda/base:1.0.0
+ARG BASE_VERSION=${BASE_VERSION:latest-}
+FROM astroconda/base:${BASE_VERSION}
LABEL maintainer="jhunk@stsci.edu" \
vendor="Space Telescope Science Institute"
diff --git a/LATEST b/LATEST
new file mode 100644
index 0000000..0b2eb36
--- /dev/null
+++ b/LATEST
@@ -0,0 +1 @@
+3.7.2
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} \
+ .