Newer
Older

Jan David Mol
committed
#
# base
#
Thomas Jürges
committed
FROM ubuntu:18.04
# Make sure that Bash is the default shell. Otherwise
# the shell's string substitutions won't work.
SHELL ["/bin/bash", "-c"]
# Add build date to the environment
ARG DOCKER_IMAGE_BUILD_DATE="The build date has to be set by a --build-arg parameter!"
ENV DOCKER_IMAGE_BUILD_DATE=${DOCKER_IMAGE_BUILD_DATE}
Thomas Jürges
committed
# Allow to specify the LOFAR branch at build time of the image.
# Use master as the default if nothing is specified.
ARG LOFAR_VERSION=latest
ENV LOFAR_VERSION=${LOFAR_VERSION}
# LOFAR_TAG is an environment variable that gets used
# (at least) by the lofar-pipeline image config file
# CEP/Pipeline/recipes/sip/pipeline.cfg.CEP4.
# It determines which version of the lofar-pipeline
# images gets executed on the nodes.
ENV LOFAR_TAG=${LOFAR_VERSION}
# Tell image build information.
ARG LOFAR_BUILDVARIANT=gnucxx11_cep4_optarch
Thomas Jürges
committed
ENV LOFAR_BUILDVARIANT=${LOFAR_BUILDVARIANT}
# Allow to specify the wanted CXX
# Default is the new one.
ARG CXX_ABI=1
ENV CXX_ABI=${CXX_ABI}

Jan David Mol
committed
#
# common-environment
#
ENV INSTALLDIR=/opt
#
# environment
#
ENV DEBIAN_FRONTEND=noninteractive \
Thomas Jürges
committed
PYTHON_VERSION=3.6

Jan David Mol
committed
#
# versions
#
PYTHON_CASACORE_VERSION=v3.0.0 \
Thomas Jürges
committed
LIBHDF5_VERSION=100 \
READLINE_VERSION=7 \
NCURSES_VERSION=5 \
PYWCS_VERSION=1.12 \

Jan David Mol
committed
#
# set-build-options
Thomas Jürges
committed
# Allow to specify the number of cpus as --build-arg.

Jan David Mol
committed
#
Thomas Jürges
committed
ARG J=6
ENV J=${J}
# Allow to overwrite the default CXX_FLAGS settings for code compilation
# by specifying --build-args CXX_FLAGS="blah blah"
ARG CXX_FLAGS="--std=c++11 -W -Wall -Woverloaded-virtual -Wno-unknown-pragmas -D_GLIBCXX_USE_CXX11_ABI=${CXX_ABI} -O3"
# Allow to overwrite the CPU optimisation default setting by specifying
# --build-arg CPU_OPTIMISATION="-march=native"
ARG CPU_OPTIMISATION="-march=haswell"
ENV CPU_OPTIMISATION=${CPU_OPTIMISATION}
# Combine CXX_FLAGS and CPU_OPTIMISATION
ENV CXX_FLAGS=${CXXFLAGS} ${CPU_OPTIMISATION}

Jan David Mol
committed
#
# Base and runtime dependencies
RUN apt-get update && apt-get install -y apt-utils aptitude && aptitude safe-upgrade -y && \
aptitude install -y bash-completion mc most htop nano sudo vim python3 libreadline${READLINE_VERSION} libncurses${NCURSES_VERSION} libopenblas-base libcfitsio-bin libwcs5 libfftw3-bin libhdf5-cpp-${LIBHDF5_VERSION} libboost-numpy${BOOST_VERSION}.1 python3-numpy python3-scipy python3-astropy libmunge2 && \
aptitude clean && \
aptitude autoclean

Jan David Mol
committed
#
# open security holes (allow smooth user switching, allow sudo)

Jan David Mol
committed
#

Jan David Mol
committed
RUN echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
Thomas Jürges
committed
sed -i 's/requiretty/!requiretty/g' /etc/sudoers

Jan David Mol
committed
#
# setup install dir
#

Jan David Mol
committed
RUN mkdir -p ${INSTALLDIR}

Jan David Mol
committed
#
# *******************
# Casacore
# *******************
#
RUN export BUILD_PACKAGES="wget git cmake g++ gfortran flex bison libreadline-dev libncurses-dev libopenblas-dev libfftw3-dev libboost-python${BOOST_VERSION}-dev libcfitsio-dev wcslib-dev python3-numpy-dev libhdf5-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \

Jan David Mol
committed
mkdir -p ${INSTALLDIR}/casacore/build && \
mkdir -p ${INSTALLDIR}/casacore/data && \
cd ${INSTALLDIR}/casacore && git clone --depth 1 --shallow-submodules --branch ${CASACORE_VERSION//latest/master} https://github.com/casacore/casacore.git src && \

Jan David Mol
committed
cd ${INSTALLDIR}/casacore/data && wget --retry-connrefused ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar && \
cd ${INSTALLDIR}/casacore/data && tar xf WSRT_Measures.ztar && rm -f WSRT_Measures.ztar && \
cd ${INSTALLDIR}/casacore/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casacore/ -DDATA_DIR=${INSTALLDIR}/casacore/data -DBUILD_PYTHON3=ON -DBUILD_PYTHON=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3 -DENABLE_TABLELOCKING=OFF -DUSE_OPENMP=ON -DUSE_FFTW3=TRUE -DUSE_HDF5=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -fsigned-char -DNDEBUG" ../src/ && \

Jan David Mol
committed
cd ${INSTALLDIR}/casacore/build && make -j ${J} && \
cd ${INSTALLDIR}/casacore/build && make install && \
bash -c "strip ${INSTALLDIR}/casacore/{lib,bin}/* || true" && \
bash -c "rm -rf ${INSTALLDIR}/casacore/{build,src}" && \
aptitude purge -y ${BUILD_PACKAGES} && \
aptitude clean && \
aptitude autoclean

Jan David Mol
committed
# Install and enable custom casarc
COPY ["casarc", "${INSTALLDIR}/"]
ENV CASARCFILES=${INSTALLDIR}/casarc

Jan David Mol
committed
#
# *******************
# Casarest
# *******************
#
Thomas Jürges
committed
# Run-time dependencies
RUN aptitude install -y libboost-system${BOOST_VERSION}.1 libboost-thread${BOOST_VERSION}.1
Thomas Jürges
committed
# Install
RUN export BUILD_PACKAGES="git cmake g++ gfortran libboost-system${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev libcfitsio-dev wcslib-dev libopenblas-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \

Jan David Mol
committed
mkdir -p ${INSTALLDIR}/casarest/build && \
cd ${INSTALLDIR}/casarest && git clone --depth 1 --shallow-submodules --branch ${CASAREST_VERSION//latest/master} https://github.com/casacore/casarest.git src && \
Thomas Jürges
committed
cd ${INSTALLDIR}/casarest/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casarest -DCASACORE_ROOT_DIR=${INSTALLDIR}/casacore -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -DNDEBUG" ../src/ && \

Jan David Mol
committed
cd ${INSTALLDIR}/casarest/build && make -j ${J} && \
cd ${INSTALLDIR}/casarest/build && make install && \
bash -c "strip ${INSTALLDIR}/casarest/{lib,bin}/* || true" && \
bash -c "rm -rf ${INSTALLDIR}/casarest/{build,src}" && \
aptitude purge -y ${BUILD_PACKAGES} && \
aptitude clean && \
aptitude autoclean

Jan David Mol
committed
#
# *******************
Thomas Jürges
committed
# Python-casacore

Jan David Mol
committed
# *******************
#
RUN export BUILD_PACKAGES="git make g++ python3-setuptools libboost-python${BOOST_VERSION}-dev libcfitsio-dev wcslib-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \

Jan David Mol
committed
mkdir ${INSTALLDIR}/python-casacore && \
cd ${INSTALLDIR}/python-casacore && git clone --depth 1 --shallow-submodules --branch ${PYTHON_CASACORE_VERSION//latest/master} https://github.com/casacore/python-casacore.git && \
cd ${INSTALLDIR}/python-casacore/python-casacore && python3 ./setup.py build_ext -I${INSTALLDIR}/casacore/include/ -L${INSTALLDIR}/casacore/lib/ && \

Jan David Mol
committed
mkdir -p ${INSTALLDIR}/python-casacore/lib/python${PYTHON_VERSION}/site-packages/ && \
mkdir -p ${INSTALLDIR}/python-casacore/lib64/python${PYTHON_VERSION}/site-packages/ && \
export PYTHONPATH=${INSTALLDIR}/python-casacore/lib/python${PYTHON_VERSION}/site-packages:${INSTALLDIR}/python-casacore/lib64/python${PYTHON_VERSION}/site-packages:${PYTHONPATH} && cd ${INSTALLDIR}/python-casacore/python-casacore && python3 ./setup.py install --prefix=${INSTALLDIR}/python-casacore/ && \

Jan David Mol
committed
bash -c "rm -rf ${INSTALLDIR}/python-casacore/python-casacore" && \
aptitude purge -y ${BUILD_PACKAGES} && \
aptitude clean && \
aptitude autoclean

Jan David Mol
committed
Thomas Jürges
committed

Jan David Mol
committed
#
# *******************
# QPID client for C++ from LOFAR repo

Jan David Mol
committed
# *******************
# ATTENTION!!!
# The LOFAR Offline package needs this until refactored!

Jan David Mol
committed
#

Jan David Mol
committed
# Run-time dependencies
# QPID daemon legacy store would require: libaio1 libdb5.1++
RUN aptitude install -y sasl2-bin libuuid1 libnss3 libnspr4 xqilla libssl1.1 libssl1.0.0 libboost-program-options${BOOST_VERSION}.1 libboost-filesystem${BOOST_VERSION}.1

Jan David Mol
committed
# Install
# QPID daemon legacy store would require: libaio-dev libdb5.1++-dev
RUN export BUILD_PACKAGES="git rsync swig ruby ruby-dev python-dev python-setuptools libsasl2-dev pkg-config cmake libtool uuid-dev libxerces-c-dev libnss3-dev libnspr4-dev help2man fakeroot build-essential g++ debhelper libssl-dev libxqilla-dev libboost-program-options${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \

Jan David Mol
committed
mkdir ${INSTALLDIR}/qpid && \
git clone --depth 1 --shallow-submodules --branch ${LOFAR_VERSION//latest/master} https://git.astron.nl/ro/lofar.git /tmp/LOFAR && \
Thomas Jürges
committed
rsync --archive /tmp/LOFAR/LCS/MessageBus/qpid/ ${INSTALLDIR}/qpid/ && \
rm -rf /tmp/LOFAR && \

Jan David Mol
committed
bash -c "HOME=/tmp ${INSTALLDIR}/qpid/local/sbin/build_qpid" && \
bash -c "strip ${INSTALLDIR}/qpid/{bin,lib}/* || true" && \
bash -c "rm -rf /tmp/sources" && \
aptitude purge -y ${BUILD_PACKAGES} && \
aptitude clean && \
aptitude autoclean

Jan David Mol
committed
#
# *******************
# Apache Proton
# *******************
#
Thomas Jürges
committed
RUN aptitude install -y libqpid-proton8 libqpid-proton-cpp8 python3-qpid-proton && \
aptitude clean && \
aptitude autoclean
# *******************
# Kombu client for Python
# *******************
RUN aptitude install -y python3-kombu

Jan David Mol
committed
#
# entry
#
Thomas Jürges
committed
COPY ["bashrc", "${INSTALLDIR}/"]
COPY ["bashrc.d", "${INSTALLDIR}/bashrc.d/"]
COPY ["chuser.sh", "/usr/local/bin"]
Thomas Jürges
committed
# Make sure that all files are readable by u,g,o and that
# the ENTRYPOINT script is also executable.
RUN chmod -R a+rx /usr/local/bin && \
find /opt/ ! -perm -a+r -exec chmod a+r {} +

Jan David Mol
committed
ENTRYPOINT ["/usr/local/bin/chuser.sh"]