diff options
-rw-r--r-- | Dockerfile | 23 | ||||
-rwxr-xr-x | build.sh | 9 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pip/001-setuptools | 0 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pip/002-testing | 5 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pip/003-prerequisites | 3 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pip/004-pipeline | 26 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pkgs/000-dummy.sh | 2 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pkgs/001-cfitsio.sh | 15 | ||||
-rw-r--r-- | etc/hstdp-2018.3a/pkgs/002-hstcal.sh | 16 | ||||
-rwxr-xr-x | etc/hstdp-2018.3a/tasks/001-python-packages.sh | 40 | ||||
-rwxr-xr-x | etc/hstdp-2018.3a/tasks/002-packages.sh | 43 | ||||
-rwxr-xr-x | etc/hstdp-2018.3a/tasks/999-clean.sh | 18 | ||||
-rwxr-xr-x | scripts/build.sh | 19 |
13 files changed, 219 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..22dd5d1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM astroconda/python:3.7.1 +LABEL maintainer="jhunk@stsci.edu" \ + vendor="Space Telescope Science Institute" + +ARG USER_ACCT=${USER_ACCT:-developer} +ARG USER_HOME=/home/${USER_ACCT} +ARG PIPELINE=${PIPELINE:-} + +WORKDIR "${TOOLCHAIN_BUILD}" + +COPY scripts/ ${TOOLCHAIN_BUILD}/bin +COPY etc/ ${TOOLCHAIN_BUILD}/etc + +USER "${USER_ACCT}" + +RUN sudo chown -R ${USER_ACCT}: ${TOOLCHAIN_BUILD} \ + && whoami \ + && bin/build.sh \ + && sudo rm -rf "${TOOLCHAIN_BUILD}" + +WORKDIR "${USER_HOME}" + +CMD ["/bin/bash", "-l"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..6c7a5f7 --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +PROJECT=astroconda/pipeline +PIPELINE="${1}" +if [[ -z ${PIPELINE} ]]; then + echo "No pipeline specified. [e.g. hst-TREE, jwst-TREE, ...]" + exit 1 +fi + +docker build -t ${PROJECT}:${PIPELINE} --build-arg PIPELINE=${PIPELINE} . diff --git a/etc/hstdp-2018.3a/pip/001-setuptools b/etc/hstdp-2018.3a/pip/001-setuptools new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/etc/hstdp-2018.3a/pip/001-setuptools diff --git a/etc/hstdp-2018.3a/pip/002-testing b/etc/hstdp-2018.3a/pip/002-testing new file mode 100644 index 0000000..c4b2c9d --- /dev/null +++ b/etc/hstdp-2018.3a/pip/002-testing @@ -0,0 +1,5 @@ +nose==1.3.7 +pytest==4.0.0 +pytest-xdist==1.24.1 +pytest-astropy==0.5.0 +pytest-virtualenv==1.3.0 diff --git a/etc/hstdp-2018.3a/pip/003-prerequisites b/etc/hstdp-2018.3a/pip/003-prerequisites new file mode 100644 index 0000000..fcc1c48 --- /dev/null +++ b/etc/hstdp-2018.3a/pip/003-prerequisites @@ -0,0 +1,3 @@ +numpy==1.15.2 +astropy==3.0.4 +relic==1.1.2 diff --git a/etc/hstdp-2018.3a/pip/004-pipeline b/etc/hstdp-2018.3a/pip/004-pipeline new file mode 100644 index 0000000..bd8265b --- /dev/null +++ b/etc/hstdp-2018.3a/pip/004-pipeline @@ -0,0 +1,26 @@ +parsley==1.3 +d2to1==0.2.12 +stsci.convolve==2.2.2 +stsci.imagestats==1.5.3 +stsci.stimage==0.2.2 +crds==7.2.6 +pysynphot==0.9.12 +git+https://github.com/spacetelescope/reftools.git@1.7.4#egg=reftools +spherical-geometry==1.2.4 +stregion==1.1.4 +stsci.ndimage==0.10.3 +stsci.sphere==0.2 +stsci.tools==3.4.13 +git+https://github.com/spacetelescope/acstools.git@2.0.10#egg=acstools +calcos==3.3.4 +fitsblender==0.3.2 +git+https://github.com/spacetelescope/nictools.git@1.1.3#egg=nictools +stistools==1.1 +stsci.image==2.3.0 +stsci.imagemanip==1.1.4 +stwcs==1.4.0 +wfc3tools==1.3.4 +git+https://github.com/spacetelescope/wfpc2tools.git@1.0.3#egg=wfpc2tools +git+https://github.com/spacetelescope/costools.git@1.2.2#egg=costools +git+https://github.com/spacetelescope/stsci.skypac@0.9.15#egg=stsci.skypac +git+https://github.com/spacetelescope/drizzlepac@2.2.4#egg=drizzlepac diff --git a/etc/hstdp-2018.3a/pkgs/000-dummy.sh b/etc/hstdp-2018.3a/pkgs/000-dummy.sh new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/etc/hstdp-2018.3a/pkgs/000-dummy.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/etc/hstdp-2018.3a/pkgs/001-cfitsio.sh b/etc/hstdp-2018.3a/pkgs/001-cfitsio.sh new file mode 100644 index 0000000..719b542 --- /dev/null +++ b/etc/hstdp-2018.3a/pkgs/001-cfitsio.sh @@ -0,0 +1,15 @@ +#!/bin/bash -e + +name=cfitsio +version=3440 +url=https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/${name}${version}.tar.gz + +sudo yum install -y libcurl-devel +curl -LO "${url}" +tar xf "$(basename ${url})" + +pushd "${name}" &>/dev/null +./configure --prefix="${PREFIX}" --enable-reentrant +make shared +make install +popd &>/dev/null diff --git a/etc/hstdp-2018.3a/pkgs/002-hstcal.sh b/etc/hstdp-2018.3a/pkgs/002-hstcal.sh new file mode 100644 index 0000000..8b4ab4f --- /dev/null +++ b/etc/hstdp-2018.3a/pkgs/002-hstcal.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e +name=hstcal +version=2.2.0 +url="https://github.com/spacetelescope/${name}" + +git clone "${url}" +pushd "${name}" &>/dev/null + # Grab a version of WAF that isn't broken + curl -o waf https://waf.io/waf-2.0.12 + chmod +x waf + + # Build / Install + ./waf configure --prefix=${PREFIX} --release-with-symbols --with-cfitsio=${PREFIX} + ./waf build + ./waf install +popd &>/dev/null diff --git a/etc/hstdp-2018.3a/tasks/001-python-packages.sh b/etc/hstdp-2018.3a/tasks/001-python-packages.sh new file mode 100755 index 0000000..3d89b6a --- /dev/null +++ b/etc/hstdp-2018.3a/tasks/001-python-packages.sh @@ -0,0 +1,40 @@ +#!/bin/bash +set -e +set -x + +# Uses GLOBAL environment variable: PYTHON_VERSION defined by `docker build` argument +prefix="${TOOLCHAIN}" +sysconfdir="${TOOLCHAIN_BUILD}/etc/${PIPELINE}" +reqdir=${sysconfdir}/pip + +export PATH="${prefix}/bin:${PATH}" +export CFLAGS="-I${prefix}/include" +export LDFLAGS="-L${prefix}/lib -Wl,-rpath=${prefix}/lib" + +function pre() +{ + if [[ ! -d ${reqdir} ]]; then + # Nothing there, but maybe that's on purpose. + exit 0 + fi +} + +function build() +{ + pre + # Iterate over pip requirement files + for req in ${reqdir}/* + do + pip install --upgrade --progress-bar=off -r "${req}" + done + post +} + +function post() +{ + rm -rf ~/.cache/pip + [[ -d src ]] && rm -rf src + [[ -f gmon.out ]] && rm -rf gmon.out +} + +build diff --git a/etc/hstdp-2018.3a/tasks/002-packages.sh b/etc/hstdp-2018.3a/tasks/002-packages.sh new file mode 100755 index 0000000..e948120 --- /dev/null +++ b/etc/hstdp-2018.3a/tasks/002-packages.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e +set -x + +prefix="${TOOLCHAIN}" +sysconfdir="${TOOLCHAIN_BUILD}/etc/${PIPELINE}" +reqdir=${sysconfdir}/pkgs +blddir=builds + +export PATH="${prefix}/bin:${PATH}" +export CFLAGS="-I${prefix}/include" +export LDFLAGS="-L${prefix}/lib -Wl,-rpath=${prefix}/lib" +export PREFIX="${prefix}" + +function pre() +{ + if [[ ! -d ${reqdir} ]]; then + # Nothing there, but maybe that's on purpose. + exit 0 + fi + mkdir -p "${blddir}" + pushd ${blddir} &>/dev/null +} + +function build() +{ + pre + # Iterate over binary package build scripts + for req in ${reqdir}/* + do + chmod +x "${req}" + "${req}" + done + post +} + +function post() +{ + popd &>/dev/null + [[ -d ${blddir} ]] && rm -rf "${blddir}" +} + +build diff --git a/etc/hstdp-2018.3a/tasks/999-clean.sh b/etc/hstdp-2018.3a/tasks/999-clean.sh new file mode 100755 index 0000000..7487b9c --- /dev/null +++ b/etc/hstdp-2018.3a/tasks/999-clean.sh @@ -0,0 +1,18 @@ +#!/bin/bash -x +if [[ ! -f /.dockerenv ]]; then + echo "This script cannot be executed outside of a docker container." + exit 1 +fi + +rm -rf "${HOME}/.astropy" +rm -rf "${HOME}/.cache" +rm -rf "${HOME}"/* + +sudo yum clean all +sudo rm -rf /tmp/* +sudo rm -rf /var/cache/yum + +for logfile in /var/log/* +do + sudo truncate --size=0 "${logfile}" +done diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..348556f --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash -e + +taskdir=${TOOLCHAIN_BUILD}/etc/${PIPELINE}/tasks + +if [[ ! -d ${taskdir} ]]; then + echo "No tasks. ${taskdir} does not exist." + exit 1 +fi + +for task in ${taskdir}/* +do + # Check for execution permission + if [[ ! -x ${task} ]]; then + echo "Skipping: ${task}" + continue + fi + echo "Executing: ${task}" + ${task} +done |