diff options
-rw-r--r-- | Dockerfile | 5 | ||||
-rwxr-xr-x | build.sh | 80 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pip/001-setuptools (renamed from etc/jwstdp-latest/pip/001-setuptools) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pip/002-testing (renamed from etc/jwstdp-latest/pip/002-testing) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pip/003-prerequisites (renamed from etc/jwstdp-latest/pip/003-prerequisites) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pip/004-pipeline (renamed from etc/jwstdp-latest/pip/004-pipeline) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pip/005-suppl (renamed from etc/jwstdp-latest/pip/005-suppl) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pkgs/000-jwst-depends.sh (renamed from etc/jwstdp-latest/pkgs/000-jwst-depends.sh) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pkgs/001-cfitsio.sh (renamed from etc/jwstdp-latest/pkgs/001-cfitsio.sh) | 0 | ||||
-rw-r--r-- | etc/jwstdp-snapshot/pkgs/002-fitsverify.sh (renamed from etc/jwstdp-latest/pkgs/002-fitsverify.sh) | 0 | ||||
-rwxr-xr-x | etc/jwstdp-snapshot/tasks/001-packages.sh (renamed from etc/jwstdp-latest/tasks/001-packages.sh) | 0 | ||||
-rwxr-xr-x | etc/jwstdp-snapshot/tasks/002-python-packages.sh (renamed from etc/jwstdp-latest/tasks/002-python-packages.sh) | 0 | ||||
-rwxr-xr-x | etc/jwstdp-snapshot/tasks/999-clean.sh (renamed from etc/jwstdp-latest/tasks/999-clean.sh) | 0 |
13 files changed, 70 insertions, 15 deletions
@@ -1,5 +1,6 @@ -ARG PYTHON_VERSION -FROM astroconda/python:${PYTHON_VERSION} +ARG HUB=${HUB:-} +ARG PYTHON_VERSION=${PYTHON_VERSION:-} +FROM "${HUB}/python:${PYTHON_VERSION}" LABEL maintainer="jhunk@stsci.edu" \ vendor="Space Telescope Science Institute" @@ -1,22 +1,76 @@ #!/bin/bash -PROJECT=astroconda/pipeline -PIPELINE="${1}" -if [[ -z ${PIPELINE} ]]; then - echo "No pipeline specified. [e.g. hst-TREE, jwst-TREE, ...]" +set -x +HUB=${3:-astroconda} +PROJECT=${HUB}/pipeline +PROJECT_VERSION="${1}" +PYTHON_VERSION="${2}" +TAGS=() +SUFFIX= +image_tag="${PROJECT_VERSION}" + +if [[ -z ${PROJECT_VERSION} ]]; then + echo "Pipeline version required [e.g. hstdp-2018.3]" exit 1 fi -PYTHON_VERSION="${2}" -if [[ -z ${PIPELINE} ]]; then - echo "Need a fully qualified python version [e.g. 3.7.1]" +if [[ -z ${PYTHON_VERSION} ]]; then + echo "Python version required [e.g. latest, 3.7.2]" exit 1 fi -SUFFIX=${PYTHON_VERSION//\./} -if [[ -z ${SUFFIX} ]]; then - echo "Unable to determine tag suffix from python version." - exit 1 +if [[ ${PYTHON_VERSION} != latest ]]; then + SUFFIX=${PYTHON_VERSION//\./} + if [[ -z ${SUFFIX} ]]; then + echo "Unable to determine tag suffix from python version." + exit 1 + fi + + image_tag="${image_tag}_py${SUFFIX}" fi -TAG="${PROJECT}:${PIPELINE}_py${SUFFIX}" -docker build -t ${TAG} --build-arg PIPELINE=${PIPELINE} --build-arg PYTHON_VERSION=${PYTHON_VERSION} . +case "${HUB}" in + *amazonaws\.com) + if ! type -p aws; then + echo "awscli client not installed" + exit 1 + fi + REGION="$(awk -F'.' '{print $(NF-2)}' <<< ${HUB})" + $(aws ecr get-login --no-include-email --region ${REGION}) + unset REGION + ;; + *) + # Assume default index + docker login + ;; +esac + +TAGS+=( "-t ${PROJECT}:${image_tag}" ) +PIPELINE="${PROJECT_VERSION}" +docker build ${TAGS[@]} \ + --build-arg HUB="${HUB}" \ + --build-arg PYTHON_VERSION="${PYTHON_VERSION}" \ + --build-arg PIPELINE="${PROJECT_VERSION}" \ + . + +rv=$? +if (( rv > 0 )); then + echo "Failed... Image not published" + exit ${rv} +fi + + +max_retry=4 +retry=0 +set +e +while (( retry != max_retry )) +do + echo "Push attempt #$(( retry + 1 ))" + docker push "${PROJECT}:${image_tag}" + rv=$? + if [[ ${rv} == 0 ]]; then + break + fi + (( retry++ )) +done + +exit ${rv} diff --git a/etc/jwstdp-latest/pip/001-setuptools b/etc/jwstdp-snapshot/pip/001-setuptools index 648f70c..648f70c 100644 --- a/etc/jwstdp-latest/pip/001-setuptools +++ b/etc/jwstdp-snapshot/pip/001-setuptools diff --git a/etc/jwstdp-latest/pip/002-testing b/etc/jwstdp-snapshot/pip/002-testing index 09a415e..09a415e 100644 --- a/etc/jwstdp-latest/pip/002-testing +++ b/etc/jwstdp-snapshot/pip/002-testing diff --git a/etc/jwstdp-latest/pip/003-prerequisites b/etc/jwstdp-snapshot/pip/003-prerequisites index 8ac5fe9..8ac5fe9 100644 --- a/etc/jwstdp-latest/pip/003-prerequisites +++ b/etc/jwstdp-snapshot/pip/003-prerequisites diff --git a/etc/jwstdp-latest/pip/004-pipeline b/etc/jwstdp-snapshot/pip/004-pipeline index 72e47d0..72e47d0 100644 --- a/etc/jwstdp-latest/pip/004-pipeline +++ b/etc/jwstdp-snapshot/pip/004-pipeline diff --git a/etc/jwstdp-latest/pip/005-suppl b/etc/jwstdp-snapshot/pip/005-suppl index 30317e9..30317e9 100644 --- a/etc/jwstdp-latest/pip/005-suppl +++ b/etc/jwstdp-snapshot/pip/005-suppl diff --git a/etc/jwstdp-latest/pkgs/000-jwst-depends.sh b/etc/jwstdp-snapshot/pkgs/000-jwst-depends.sh index 88cc61e..88cc61e 100644 --- a/etc/jwstdp-latest/pkgs/000-jwst-depends.sh +++ b/etc/jwstdp-snapshot/pkgs/000-jwst-depends.sh diff --git a/etc/jwstdp-latest/pkgs/001-cfitsio.sh b/etc/jwstdp-snapshot/pkgs/001-cfitsio.sh index 719b542..719b542 100644 --- a/etc/jwstdp-latest/pkgs/001-cfitsio.sh +++ b/etc/jwstdp-snapshot/pkgs/001-cfitsio.sh diff --git a/etc/jwstdp-latest/pkgs/002-fitsverify.sh b/etc/jwstdp-snapshot/pkgs/002-fitsverify.sh index 424daf8..424daf8 100644 --- a/etc/jwstdp-latest/pkgs/002-fitsverify.sh +++ b/etc/jwstdp-snapshot/pkgs/002-fitsverify.sh diff --git a/etc/jwstdp-latest/tasks/001-packages.sh b/etc/jwstdp-snapshot/tasks/001-packages.sh index e64fe06..e64fe06 100755 --- a/etc/jwstdp-latest/tasks/001-packages.sh +++ b/etc/jwstdp-snapshot/tasks/001-packages.sh diff --git a/etc/jwstdp-latest/tasks/002-python-packages.sh b/etc/jwstdp-snapshot/tasks/002-python-packages.sh index 33714aa..33714aa 100755 --- a/etc/jwstdp-latest/tasks/002-python-packages.sh +++ b/etc/jwstdp-snapshot/tasks/002-python-packages.sh diff --git a/etc/jwstdp-latest/tasks/999-clean.sh b/etc/jwstdp-snapshot/tasks/999-clean.sh index 7487b9c..7487b9c 100755 --- a/etc/jwstdp-latest/tasks/999-clean.sh +++ b/etc/jwstdp-snapshot/tasks/999-clean.sh |