Commit ccff150a authored by Carlo Ferrigno's avatar Carlo Ferrigno
Browse files

Initial commit

parents
2021-02-08 HEASARC Software
* v0.4
* Complete Dockerfiles: Combined wget & build sections into
a single RUN layer to free up space
2021-02-05 HEASARC Software
* v0.3
* Complete Dockerfile: Added "make clean" & rm of Xspec/src/spectral
* Complete Dockerfile_example: Added rm of all src code
2021-02-01 HEASARC Software
* v0.2
* All Dockerfiles: Added install of HEASoftPy
* Dockerfile_example: Example Dockerfile for full distribution
that adds in extra Python packages and vim
* README: Added clarifications + new text about editing
Dockerfiles, preserving changes, and cleaning up.
2021-01-28 HEASARC Software
* v0.1
* All Dockerfiles: Added install of numpy and python-is-python3
2021-01-21 HEASARC Software
* Initial distribution
FROM ubuntu:20.04
ARG version=6.28
ENV HEASOFT_VERSION=${version}
ARG hsp_ver=0.1.17
LABEL version="${version}" \
description="HEASoft ${version} https://heasarc.gsfc.nasa.gov/lheasoft/" \
maintainer="NASA/GSFC/HEASARC https://heasarc.gsfc.nasa.gov/cgi-bin/ftoolshelp"
# Install HEASoft prerequisites
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
gcc \
gfortran \
g++ \
libcurl4 \
libcurl4-gnutls-dev \
libncurses5-dev \
libreadline6-dev \
make \
ncurses-dev \
perl-modules \
python3-dev \
ipython3 \
python3-pip \
python-is-python3 \
tcsh \
wget \
xorg-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd heasoft && useradd -r -m -g heasoft heasoft \
&& mkdir -p /opt/heasoft/caldb \
&& chown -R heasoft:heasoft /opt/heasoft
USER heasoft
WORKDIR /home/heasoft
#Install python packages using PIP
ADD requirements.txt /home/heasoft/requirements.txt
RUN pip3 install -r /home/heasoft/requirements.txt && \
rm /home/heasoft/requirements.txt
# Retrieve the HEASoft source code, unpack, configure,
# make, install, clean up, and create symlinks....
ARG heasoft_tarfile_suffix=src
#Copy to avoid downloading in development
COPY heasoft-6.28src.tar.gz /home/heasoft
#RUN wget https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${HEASOFT_VERSION}/heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz
RUN tar xzvf heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& rm -f heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& cd ${HOME}/heasoft-${HEASOFT_VERSION}/BUILD_DIR/ \
&& ./configure --prefix=/opt/heasoft 2>&1 | tee ${HOME}/configure.log \
&& make 2>&1 | tee ${HOME}/build.log \
&& make install 2>&1 | tee ${HOME}/install.log \
&& make clean 2>&1 | tee ${HOME}/clean.log \
&& rm -f ${HOME}/clean.log \
&& /bin/bash -c 'cd /opt/heasoft/; for loop in x86_64*/*; do ln -sf $loop; done' \
&& cd ${HOME}/heasoft-${HEASOFT_VERSION} \
&& cp -p Xspec/BUILD_DIR/hmakerc /opt/heasoft/bin/ \
&& cp -p Xspec/BUILD_DIR/Makefile-std /opt/heasoft/bin/ \
&& /bin/bash -c 'tar cf - `find Xspec/src -name "*.h" -print` | (cd /opt/heasoft/; tar xf -)' \
&& rm -rf Xspec/src/spectral \
&& cd \
&& gzip -9 ${HOME}/*.log \
&& cp -p ${HOME}/heasoft-${HEASOFT_VERSION}/Release_Notes* /opt/heasoft/
# && rm -rf ${HOME}/heasoft-${HEASOFT_VERSION}*
# Configure shells...
RUN /bin/echo >> /home/heasoft/.bashrc \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.bashrc \
&& /bin/echo 'export HEADAS=/opt/heasoft' >> /home/heasoft/.bashrc \
&& /bin/echo '. $HEADAS/headas-init.sh' >> /home/heasoft/.bashrc \
&& /bin/echo >> /home/heasoft/.bashrc \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDBCONFIG=/opt/heasoft/caldb/caldb.config' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDBALIAS=/opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.bashrc \
&& /bin/echo >> /home/heasoft/.profile \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.profile \
&& /bin/echo 'export HEADAS=/opt/heasoft' >> /home/heasoft/.profile \
&& /bin/echo '. $HEADAS/headas-init.sh' >> /home/heasoft/.profile \
&& /bin/echo >> /home/heasoft/.profile \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDBCONFIG=/opt/heasoft/caldb/caldb.config' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDBALIAS=/opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.profile \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv HEADAS /opt/heasoft' >> /home/heasoft/.cshrc \
&& /bin/echo 'source $HEADAS/headas-init.csh' >> /home/heasoft/.cshrc \
&& /bin/echo >> /home/heasoft/.cshrc \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDB https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDBCONFIG /opt/heasoft/caldb/caldb.config' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDBALIAS /opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.cshrc
RUN cd /opt/heasoft/caldb \
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/software/tools/caldb.config \
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/software/tools/alias_config.fits
ENV CC=/usr/bin/gcc \
CXX=/usr/bin/g++ \
FC=/usr/bin/gfortran \
PERL=/usr/bin/perl \
PERLLIB=/opt/heasoft/lib/perl \
PERL5LIB=/opt/heasoft/lib/perl \
PYTHON=/usr/bin/python \
PYTHONPATH=/opt/heasoft/lib/python:/opt/heasoft/lib \
PATH=/opt/heasoft/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
HEADAS=/opt/heasoft \
LHEASOFT=/opt/heasoft \
FTOOLS=/opt/heasoft \
LD_LIBRARY_PATH=/opt/heasoft/lib \
LHEAPERL=/usr/bin/perl \
PFCLOBBER=1 \
PFILES=/home/heasoft/pfiles;/opt/heasoft/syspfiles \
FTOOLSINPUT=stdin \
FTOOLSOUTPUT=stdout \
LHEA_DATA=/opt/heasoft/refdata \
LHEA_HELP=/opt/heasoft/help \
EXT=lnx \
PGPLOT_FONT=/opt/heasoft/lib/grfont.dat \
PGPLOT_RGB=/opt/heasoft/lib/rgb.txt \
PGPLOT_DIR=/opt/heasoft/lib \
POW_LIBRARY=/opt/heasoft/lib/pow \
XRDEFAULTS=/opt/heasoft/xrdefaults \
TCLRL_LIBDIR=/opt/heasoft/lib \
XANADU=/opt/heasoft \
XANBIN=/opt/heasoft \
CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb \
CALDBCONFIG=/opt/heasoft/caldb/caldb.config \
CALDBALIAS=/opt/heasoft/caldb/alias_config.fits
# Install HEASoftPy:
RUN cd /opt/heasoft/lib/python \
&& wget https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${HEASOFT_VERSION}/heasoftpy${hsp_ver}.tar \
&& tar xf heasoftpy${hsp_ver}.tar \
&& rm -f heasoftpy${hsp_ver}.tar \
&& cd /opt/heasoft/lib/python/heasoftpy \
&& /usr/bin/python3 install.py
COPY init.sh /usr/local/bin
COPY init.csh /usrl/local/bin
CMD [ "fversion" ]
FROM ubuntu:20.04
ARG version=6.28
ENV HEASOFT_VERSION=${version}
ARG hsp_ver=0.1.17
LABEL version="${version}" \
description="HEASoft ${version} https://heasarc.gsfc.nasa.gov/lheasoft/" \
maintainer="NASA/GSFC/HEASARC https://heasarc.gsfc.nasa.gov/cgi-bin/ftoolshelp"
# Install HEASoft prerequisites
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
gcc \
gfortran \
g++ \
libcurl4 \
libcurl4-gnutls-dev \
libncurses5-dev \
libreadline6-dev \
make \
ncurses-dev \
perl-modules \
python3-dev \
python3-astropy \
python3-astroquery \
python3-matplotlib \
python3-numpy \
python3-pandas \
python3-pip \
python3-pyvo \
python3-scipy \
python-is-python3 \
ipython3 \
tcsh \
wget \
xorg-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd heasoft && useradd -r -m -g heasoft heasoft \
&& mkdir -p /opt/heasoft/caldb \
&& chown -R heasoft:heasoft /opt/heasoft
USER heasoft
WORKDIR /home/heasoft
# Retrieve the HEASoft source code, unpack, configure,
# make, install, clean up, and create symlinks....
ARG heasoft_tarfile_suffix=src
RUN wget https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${HEASOFT_VERSION}/heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& tar xzvf heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& rm -f heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& cd ${HOME}/heasoft-${HEASOFT_VERSION}/BUILD_DIR/ \
&& ./configure --prefix=/opt/heasoft 2>&1 | tee ${HOME}/configure.log \
&& make 2>&1 | tee ${HOME}/build.log \
&& make install 2>&1 | tee ${HOME}/install.log \
&& /bin/bash -c 'cd /opt/heasoft/; for loop in x86_64*/*; do ln -sf $loop; done' \
&& cd ${HOME}/heasoft-${HEASOFT_VERSION} \
&& cp -p Xspec/BUILD_DIR/hmakerc /opt/heasoft/bin/ \
&& cp -p Xspec/BUILD_DIR/Makefile-std /opt/heasoft/bin/ \
&& /bin/bash -c 'tar cf - `find Xspec/src -name "*.h" -print` | (cd /opt/heasoft/; tar xf -)' \
&& cd \
&& gzip -9 ${HOME}/*.log \
&& cp -p ${HOME}/heasoft-${HEASOFT_VERSION}/Release_Notes* /opt/heasoft/ \
&& rm -rf ${HOME}/heasoft-${HEASOFT_VERSION}*
# Configure shells...
RUN /bin/echo >> /home/heasoft/.bashrc \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.bashrc \
&& /bin/echo 'export HEADAS=/opt/heasoft' >> /home/heasoft/.bashrc \
&& /bin/echo '. $HEADAS/headas-init.sh' >> /home/heasoft/.bashrc \
&& /bin/echo >> /home/heasoft/.bashrc \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDBCONFIG=/opt/heasoft/caldb/caldb.config' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDBALIAS=/opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.bashrc \
&& /bin/echo >> /home/heasoft/.profile \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.profile \
&& /bin/echo 'export HEADAS=/opt/heasoft' >> /home/heasoft/.profile \
&& /bin/echo '. $HEADAS/headas-init.sh' >> /home/heasoft/.profile \
&& /bin/echo >> /home/heasoft/.profile \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDBCONFIG=/opt/heasoft/caldb/caldb.config' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDBALIAS=/opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.profile \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv HEADAS /opt/heasoft' >> /home/heasoft/.cshrc \
&& /bin/echo 'source $HEADAS/headas-init.csh' >> /home/heasoft/.cshrc \
&& /bin/echo >> /home/heasoft/.cshrc \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDB https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDBCONFIG /opt/heasoft/caldb/caldb.config' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDBALIAS /opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.cshrc
RUN cd /opt/heasoft/caldb \
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/software/tools/caldb.config \
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/software/tools/alias_config.fits
ENV CC=/usr/bin/gcc \
CXX=/usr/bin/g++ \
FC=/usr/bin/gfortran \
PERL=/usr/bin/perl \
PERLLIB=/opt/heasoft/lib/perl \
PERL5LIB=/opt/heasoft/lib/perl \
PYTHON=/usr/bin/python \
PYTHONPATH=/opt/heasoft/lib/python:/opt/heasoft/lib \
PATH=/opt/heasoft/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
HEADAS=/opt/heasoft \
LHEASOFT=/opt/heasoft \
FTOOLS=/opt/heasoft \
LD_LIBRARY_PATH=/opt/heasoft/lib \
LHEAPERL=/usr/bin/perl \
PFCLOBBER=1 \
PFILES=/home/heasoft/pfiles;/opt/heasoft/syspfiles \
FTOOLSINPUT=stdin \
FTOOLSOUTPUT=stdout \
LHEA_DATA=/opt/heasoft/refdata \
LHEA_HELP=/opt/heasoft/help \
EXT=lnx \
PGPLOT_FONT=/opt/heasoft/lib/grfont.dat \
PGPLOT_RGB=/opt/heasoft/lib/rgb.txt \
PGPLOT_DIR=/opt/heasoft/lib \
POW_LIBRARY=/opt/heasoft/lib/pow \
XRDEFAULTS=/opt/heasoft/xrdefaults \
TCLRL_LIBDIR=/opt/heasoft/lib \
XANADU=/opt/heasoft \
XANBIN=/opt/heasoft \
CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb \
CALDBCONFIG=/opt/heasoft/caldb/caldb.config \
CALDBALIAS=/opt/heasoft/caldb/alias_config.fits
# Install HEASoftPy:
RUN cd /opt/heasoft/lib/python \
&& wget https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${HEASOFT_VERSION}/heasoftpy${hsp_ver}.tar \
&& tar xf heasoftpy${hsp_ver}.tar \
&& rm -f heasoftpy${hsp_ver}.tar \
&& cd /opt/heasoft/lib/python/heasoftpy \
&& /usr/bin/python3 install.py
CMD [ "fversion" ]
FROM ubuntu:20.04
ARG version=6.28
ENV HEASOFT_VERSION=${version}
ARG hsp_ver=0.1.17
LABEL version="${version}" \
description="HEASoft ${version} https://heasarc.gsfc.nasa.gov/lheasoft/" \
maintainer="NASA/GSFC/HEASARC https://heasarc.gsfc.nasa.gov/cgi-bin/ftoolshelp"
# Install HEASoft prerequisites
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
gcc \
gfortran \
g++ \
libcurl4 \
libcurl4-gnutls-dev \
libncurses5-dev \
libreadline6-dev \
make \
ncurses-dev \
perl-modules \
python3-dev \
python3-numpy \
python-is-python3 \
tcsh \
wget \
xorg-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd heasoft && useradd -r -m -g heasoft heasoft \
&& mkdir -p /opt/heasoft/caldb \
&& chown -R heasoft:heasoft /opt/heasoft
USER heasoft
WORKDIR /home/heasoft
# Retrieve the HEASoft source code, unpack, configure,
# make, install, clean up, and create symlinks....
ARG heasoft_tarfile_suffix=src
RUN wget https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${HEASOFT_VERSION}/heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& tar xzvf heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& rm -f heasoft-${HEASOFT_VERSION}${heasoft_tarfile_suffix}.tar.gz \
&& cd ${HOME}/heasoft-${HEASOFT_VERSION}/BUILD_DIR/ \
&& ./configure --prefix=/opt/heasoft 2>&1 | tee ${HOME}/configure.log \
&& make 2>&1 | tee ${HOME}/build.log \
&& make install 2>&1 | tee ${HOME}/install.log \
&& make clean 2>&1 | tee ${HOME}/clean.log \
&& rm -f ${HOME}/clean.log \
&& /bin/bash -c 'cd /opt/heasoft/; for loop in x86_64*/*; do ln -sf $loop; done' \
&& cd ${HOME}/heasoft-${HEASOFT_VERSION} \
&& cp -p Xspec/BUILD_DIR/hmakerc /opt/heasoft/bin/ \
&& cp -p Xspec/BUILD_DIR/Makefile-std /opt/heasoft/bin/ \
&& /bin/bash -c 'tar cf - `find Xspec/src -name "*.h" -print` | (cd /opt/heasoft/; tar xf -)' \
&& rm -rf Xspec/src/spectral \
&& cd \
&& gzip -9 ${HOME}/*.log \
&& cp -p ${HOME}/heasoft-${HEASOFT_VERSION}/Release_Notes* /opt/heasoft/
# Configure shells...
RUN /bin/echo >> /home/heasoft/.bashrc \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.bashrc \
&& /bin/echo 'export HEADAS=/opt/heasoft' >> /home/heasoft/.bashrc \
&& /bin/echo '. $HEADAS/headas-init.sh' >> /home/heasoft/.bashrc \
&& /bin/echo >> /home/heasoft/.bashrc \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDBCONFIG=/opt/heasoft/caldb/caldb.config' >> /home/heasoft/.bashrc \
&& /bin/echo 'export CALDBALIAS=/opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.bashrc \
&& /bin/echo >> /home/heasoft/.profile \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.profile \
&& /bin/echo 'export HEADAS=/opt/heasoft' >> /home/heasoft/.profile \
&& /bin/echo '. $HEADAS/headas-init.sh' >> /home/heasoft/.profile \
&& /bin/echo >> /home/heasoft/.profile \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDBCONFIG=/opt/heasoft/caldb/caldb.config' >> /home/heasoft/.profile \
&& /bin/echo 'export CALDBALIAS=/opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.profile \
&& /bin/echo '# Initialize HEASoft environment' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv HEADAS /opt/heasoft' >> /home/heasoft/.cshrc \
&& /bin/echo 'source $HEADAS/headas-init.csh' >> /home/heasoft/.cshrc \
&& /bin/echo >> /home/heasoft/.cshrc \
&& /bin/echo '# Initialize environment for CALDB' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDB https://heasarc.gsfc.nasa.gov/FTP/caldb' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDBCONFIG /opt/heasoft/caldb/caldb.config' >> /home/heasoft/.cshrc \
&& /bin/echo 'setenv CALDBALIAS /opt/heasoft/caldb/alias_config.fits' >> /home/heasoft/.cshrc
RUN cd /opt/heasoft/caldb \
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/software/tools/caldb.config \
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/software/tools/alias_config.fits
ENV CC=/usr/bin/gcc \
CXX=/usr/bin/g++ \
FC=/usr/bin/gfortran \
PERL=/usr/bin/perl \
PERLLIB=/opt/heasoft/lib/perl \
PERL5LIB=/opt/heasoft/lib/perl \
PYTHON=/usr/bin/python \
PYTHONPATH=/opt/heasoft/lib/python:/opt/heasoft/lib \
PATH=/opt/heasoft/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
HEADAS=/opt/heasoft \
LHEASOFT=/opt/heasoft \
FTOOLS=/opt/heasoft \
LD_LIBRARY_PATH=/opt/heasoft/lib \
LHEAPERL=/usr/bin/perl \
PFCLOBBER=1 \
PFILES=/home/heasoft/pfiles;/opt/heasoft/syspfiles \
FTOOLSINPUT=stdin \
FTOOLSOUTPUT=stdout \
LHEA_DATA=/opt/heasoft/refdata \
LHEA_HELP=/opt/heasoft/help \
EXT=lnx \
PGPLOT_FONT=/opt/heasoft/lib/grfont.dat \
PGPLOT_RGB=/opt/heasoft/lib/rgb.txt \
PGPLOT_DIR=/opt/heasoft/lib \
POW_LIBRARY=/opt/heasoft/lib/pow \
XRDEFAULTS=/opt/heasoft/xrdefaults \
TCLRL_LIBDIR=/opt/heasoft/lib \
XANADU=/opt/heasoft \
XANBIN=/opt/heasoft \
CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb \
CALDBCONFIG=/opt/heasoft/caldb/caldb.config \
CALDBALIAS=/opt/heasoft/caldb/alias_config.fits
# Install HEASoftPy:
RUN cd /opt/heasoft/lib/python \
&& wget https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft${HEASOFT_VERSION}/heasoftpy${hsp_ver}.tar \
&& tar xf heasoftpy${hsp_ver}.tar \
&& rm -f heasoftpy${hsp_ver}.tar \
&& cd /opt/heasoft/lib/python/heasoftpy \
&& /usr/bin/python3 install.py
CMD [ "fversion" ]
#=============================================================================#
# File Description:
# Used for building HEASoft Docker image.
#=============================================================================#
IMAGE_NAME = carloferrigno/heasoft
IMAGE_VERSION = 6.28
IMAGE_LABEL = v$(IMAGE_VERSION)
DOCKER = docker
#DOCKER = sudo docker
image:
@echo "Building Docker image ${IMAGE_NAME}:${IMAGE_LABEL}..."
-$(DOCKER) build --network=host --build-arg version=$(IMAGE_VERSION) -t $(IMAGE_NAME):$(IMAGE_LABEL) .
latest: image
@echo "Tagging Docker image ${IMAGE_NAME}:${IMAGE_LABEL} with latest..."
-$(DOCKER) tag `$(DOCKER) image ls --format '{{.ID}}' $(IMAGE_NAME):$(IMAGE_LABEL)` $(IMAGE_NAME):latest
HEASoft & Docker:
=================
What is Docker?
To learn all about Docker, please visit https://www.docker.com.
For our purposes, Docker enables packaging HEASoft as a
standalone executable container that includes everything
needed to run HEASoft: the code, the system tools and
libraries, and the settings.
The primary benefit for HEASoft users is that it allows for
an easier installation process and use of our software on any
operating system supported by Docker.
Currently, we provide two approaches for installing HEASoft
with Docker, both of which require that you have installed
the Docker Engine (i.e. the Docker application or executable)
available from
https://www.docker.com/products/docker-desktop
and that you have it running. Also note that older versions
of Docker may not be compatible with some of the syntax used
below, so it's a good idea to make sure your Docker application
is up-to-date.
The "docker" commands below require that in addition to having
the Docker engine running, you should have the command-line
"docker" executable available in your Unix PATH. It typically
installs as /usr/local/bin/docker, so either add /usr/local/bin
to your PATH (and run "rehash"), or in the commands below
replace "docker" with "/usr/local/bin/docker".
Our two approaches are the following:
1) A Dockerfile that retrieves a complete HEASoft source
code tar file and then creates an Ubuntu Linux container
into which all of HEASoft is installed. To use this
approach, download this tar file:
https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/release/heasoft-6.28docker0.4.tar
Unpack it anywhere you choose, and then run "make":
$ tar xf heasoft-6.28docker0.4.tar
$ make
Or, if necessary:
$ sudo make
2) For users who do not need all of HEASoft, the standard
"a la carte" tar files downloadable from
https://heasarc.gsfc.nasa.gov/lheasoft/download.html
now unpack with a Docker folder from which one can
install a container that includes only the packages
that were selected for inclusion.
Once you have downloaded and unpacked your HEASoft source
code, make sure that you have a GNU tar executable - for
example "gtar" "gnutar", or perhaps just "tar" - in your
PATH or else assigned to the TAR environment variable,
and then run "make" inside the Docker folder:
$ cd heasoft-6.28/Docker
$ make
Or, if necessary:
$ sudo make
For either approach, note that you may need to run "sudo make"
instead of just "make" if your docker executable requires root
permission to run. In either case, "make" will launch the
appropriate set of commands to create and set up a new Ubuntu
Linux container, and then configure, build, and install
HEASoft inside the container. This process may take a while
depending on your hardware and which approach you selected.
At first you will see some screen output from the various
build commands, and you may eventually see a message that a
"log limit" of 1MiB has been reached, but this is normal and
does not imply that an error has occurred.
When it has finished, you may open the container in Docker,
using for example:
$ docker run --rm -it heasoft:v6.28 tcsh
This command should provide you with an interactive docker
prompt for the new container in a "T" C-shell, and place
you in the /home/heasoft directory.
Alternatively you may want to start up docker adding a
volume from your host machine to the container, for example:
$ docker run --rm -it -v /Users/user1/data:/mydata heasoft:v6.28 tcsh
This should mount the host directory "/Users/user1/data"
inside the container as "/mydata". More information about
this and other Docker options can be found at their site:
https://docs.docker.com
At this point you might run "fversion" to confirm that the
installation is working,
$ fversion
or "fhelp" to get more information about a particular task
or package, for example:
$ fhelp heatools
Note that the HEASARC CALDB has been set up in your
environment using the "remote" setting:
CALDB=https://heasarc.gsfc.nasa.gov/FTP/caldb
CALDBCONFIG=/opt/heasoft/caldb/caldb.config
CALDBALIAS=/opt/heasoft/caldb/alias_config.fits
Xspec users may add local models as desired in the standard way.
Displays:
=========
To use GUI tasks (FV, etc.) or display plot windows from e.g.
Xspec, modifications can be made to your X server connections.
For example, on Mac hosts running XQuartz, open the XQuartz
Preferences menu, and in the Security tab check the
"Allow connections from network clients" box. Then, quit
XQuartz and restart it. From a new X terminal run these
commands to start up the container with an X connection:
$ /opt/X11/bin/xhost + 127.0.0.1
$ docker run --rm -it -e DISPLAY=host.docker.internal:0 heasoft:v6.28 tcsh
For Linux hosts with X11 installed, start the container with:
$ docker run --rm -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro heasoft:v6.28 tcsh
Then, in a separate terminal:
$ docker ps -l -q
$ xhost +local:<output from previous command>
These two steps could alternatively be combined as:
$ xhost +local:`docker ps -l -q`
Python, and editing the Dockerfiles:
====================================
PyXspec and the HEASP Python interface are both available,
accessible by running python (which is python3 by default)
and importing the relevant package.
In the future, other Python packages may be installed by
default as part of our Dockerfiles, but for now users
are of course free to edit these files to suit their
purposes. For example, under the "HEASoft prerequisites"
section, an Ubuntu 'apt-get' command installs a number