From f17f08d418e285d28b9b414b657e287556566497 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 22 Jan 2019 11:00:04 -0500 Subject: Use python dynamically * Improve tag situation --- Dockerfile | 3 ++- build.sh | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 22dd5d1..8ad5e5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM astroconda/python:3.7.1 +ARG PYTHON_VERSION +FROM astroconda/python:${PYTHON_VERSION} LABEL maintainer="jhunk@stsci.edu" \ vendor="Space Telescope Science Institute" diff --git a/build.sh b/build.sh index 6c7a5f7..b4249bc 100755 --- a/build.sh +++ b/build.sh @@ -6,4 +6,17 @@ if [[ -z ${PIPELINE} ]]; then exit 1 fi -docker build -t ${PROJECT}:${PIPELINE} --build-arg PIPELINE=${PIPELINE} . +PYTHON_VERSION="${2}" +if [[ -z ${PIPELINE} ]]; then + echo "Need a fully qualified python version [e.g. 3.7.1]" + exit 1 +fi + +SUFFIX=${PYTHON_VERSION//\./} +if [[ -z ${SUFFIX} ]]; then + echo "Unable to determine tag suffix from python version." + exit 1 +fi + +TAG="${PROJECT}:${PIPELINE}_py${SUFFIX}" +docker build -t ${TAG} --build-arg PIPELINE=${PIPELINE} --build-arg PYTHON_VERSION=${PYTHON_VERSION} . -- cgit