Docker and singularity images

The pipeline currently uses WSClean and DP3 to make images, generate model visibilities from them, and perfom calibration against the models.

If they are installed locally, the pipeline can run those programs directly on bare metal. Otherwise, it can also run them within a singularity container, but a singularity image file with DP3 and WSClean installed must be built first.

We maintain both a Dockerfile and Singularity recipe for those programs.

Singularity build

The recommended method is to directly use the Singularity recipe file provided. Navigate to the base directory of the repository from a terminal and run:

cd docker/
singularity build <MY_IMAGE_FILE> Singularity

You may have to run with sudo or add the --fakeroot option depending on how singularity was installed on your machine.

Docker build

To build a docker image, navigate to the base directory of the repository from a terminal and run:

cd docker/
docker build -f Dockerfile --tag <MY_IMAGE_TAG> .

Singularity recipe

Bootstrap: docker
From: ubuntu:22.04
Stage: spython-base

%post
# NOTE: the dockerfile uses the 22.04 version for ubuntu because we need the
#       recent python version shipped with it for CI tests
 
# NOTE: adding libopenmpi-dev means that wsclean-mp gets built automatically
export DEBIAN_FRONTEND="noninteractive" && \
apt-get update && \
apt-get install -y \
bison \
build-essential \
cmake \
doxygen \
flex \
gfortran \
git \
libarmadillo-dev \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-python-dev \
libboost-system-dev \
libboost-test-dev \
libcfitsio-dev \
libfftw3-dev \
libgsl-dev \
libgtkmm-3.0-dev \
libhdf5-serial-dev \
liblua5.3-dev \
libopenmpi-dev \
libpng-dev \
ninja-build \
pkg-config \
pybind11-dev \
python3-dev \
python3-numpy \
python3-pip \
wcslib-dev \
wget \
&& \
rm -rf /var/lib/apt/lists/*

# Build casacore
CASACORE_VERSION=v3.5.0

mkdir /casacore && cd /casacore \
&& git clone https://github.com/casacore/casacore.git src \
&& ( cd src/ && git checkout ${CASACORE_VERSION} ) \
&& mkdir build && cd build \
&& cmake -DUSE_READLINE=NO -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr ../src \
&& make -j4 install \
&& cd / && rm -rf casacore

# Build aoflagger3
AOFLAGGER_VERSION=v3.4.0

mkdir /aoflagger && cd /aoflagger \
&& git clone https://gitlab.com/aroffringa/aoflagger.git src \
&& ( cd src/ && git checkout ${AOFLAGGER_VERSION} ) \
&& mkdir build && cd build \
&& cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../src \
&& ninja install \
&& cd / && rm -rf aoflagger

# Build IDG
# (PORTABLE: it may run on a different node than where it was compiled)
IDG_VERSION=1.1.0

mkdir /idg && cd /idg \
&& git clone https://git.astron.nl/RD/idg.git src \
&& ( cd src/ && git checkout ${IDG_VERSION} ) \
&& mkdir build && cd build \
&& cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DPORTABLE=ON ../src \
&& ninja install \
&& cd / && rm -rf idg

# Build EveryBeam
# NOTE: The recent (Mar 2024) version of WSClean we use below
# wants EveryBeam >= v0.5.5, we use the latest release.
EVERYBEAM_VERSION=v0.5.6

mkdir /everybeam && cd /everybeam \
&& git clone https://git.astron.nl/RD/EveryBeam.git src \
&& ( cd src/ && git checkout ${EVERYBEAM_VERSION} ) \
&& mkdir build && cd build \
&& cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../src -DPYTHON_EXECUTABLE=/usr/bin/python3 \
&& ninja install \
&& cd / && rm -rf everybeam

# Install pip dependencies
pip3 install \
autosemver==0.5.5 \
gcovr \
h5py \
jsonschema2rst \
sphinx \
sphinx-rtd-theme

# Build DP3
# This is tip of the master branch from 12/01/2024
DP3_VERSION=f7b083a5489b6afe2cd8a781a792047430fff191

mkdir /dp3 && cd /dp3 \
&& git clone https://git.astron.nl/RD/DP3.git src \
&& cd src \
&& git checkout ${DP3_VERSION} \
&& git submodule update --init --recursive \
&& mkdir build && cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j4 install \
&& cd / && rm -rf dp3
PYTHONPATH=/usr/local/lib/python3.10/site-packages

# Build WSClean
# This is the tip of the master branch from 10/04/2024
# This version contains a fix to wsclean-mp crashes with high values of
# -channels-out
WSCLEAN_VERSION=daf969711d9d7f7f8e01ffcff493c7bd13d2fe3c

mkdir /wsclean && cd /wsclean \
&& git clone https://gitlab.com/aroffringa/wsclean.git src \
&& cd src \
&& git checkout ${WSCLEAN_VERSION} \
&& git submodule update --init --recursive

cd /wsclean \
&& mkdir build && cd build \
&& cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../src \
&& ninja install \
&& cd / && rm -rf wsclean

# Install WSRT Measures (extra casacore data, for integration tests)
# Note: The file on the ftp site is updated daily. When warnings regarding leap
# seconds appear, ignore them or regenerate the docker image.
wget -nv -O /WSRT_Measures.ztar ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar \
&& mkdir -p /usr/share/casacore/data \
&& cd /usr/share/casacore/data \
&& tar xfz /WSRT_Measures.ztar \
&& rm /WSRT_Measures.ztar
%environment
export CASACORE_VERSION=v3.5.0
export AOFLAGGER_VERSION=v3.4.0
export IDG_VERSION=1.1.0
export EVERYBEAM_VERSION=v0.5.6
export DP3_VERSION=f7b083a5489b6afe2cd8a781a792047430fff191
export PYTHONPATH=/usr/local/lib/python3.10/site-packages
export WSCLEAN_VERSION=daf969711d9d7f7f8e01ffcff493c7bd13d2fe3c
%runscript
exec /bin/bash "$@"
%startscript
exec /bin/bash "$@"

Dockerfile

FROM ubuntu:22.04
# NOTE: the dockerfile uses the 22.04 version for ubuntu because we need the
#       recent python version shipped with it for CI tests
 
# NOTE: adding libopenmpi-dev means that wsclean-mp gets built automatically
RUN export DEBIAN_FRONTEND="noninteractive" && \
    apt-get update && \
    apt-get install -y \
        bison \
        build-essential \
        cmake \
        doxygen \
        flex \
        gfortran \
        git \
        libarmadillo-dev \
        libboost-date-time-dev \
        libboost-filesystem-dev \
        libboost-program-options-dev \
        libboost-python-dev \
        libboost-system-dev \
        libboost-test-dev \
        libcfitsio-dev \
        libfftw3-dev \
        libgsl-dev \
        libgtkmm-3.0-dev \
        libhdf5-serial-dev \
        liblua5.3-dev \
        libopenmpi-dev \
        libpng-dev \
        ninja-build \
        pkg-config \
        pybind11-dev \
        python3-dev \
        python3-numpy \
        python3-pip \
        wcslib-dev \
        wget \
    && \
    rm -rf /var/lib/apt/lists/*

# Build casacore
ENV CASACORE_VERSION=v3.5.0

RUN mkdir /casacore && cd /casacore \
    && git clone https://github.com/casacore/casacore.git src \
    && ( cd src/ && git checkout ${CASACORE_VERSION} ) \
    && mkdir build && cd build \
    && cmake -DUSE_READLINE=NO -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr ../src \
    && make -j4 install \
    && cd / && rm -rf casacore

# Build aoflagger3
ENV AOFLAGGER_VERSION=v3.4.0

RUN mkdir /aoflagger && cd /aoflagger \
    && git clone https://gitlab.com/aroffringa/aoflagger.git src \
    && ( cd src/ && git checkout ${AOFLAGGER_VERSION} ) \
    && mkdir build && cd build \
    && cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../src \
    && ninja install \
    && cd / && rm -rf aoflagger

# Build IDG
# (PORTABLE: it may run on a different node than where it was compiled)
ENV IDG_VERSION=1.1.0

RUN mkdir /idg && cd /idg \
    && git clone https://git.astron.nl/RD/idg.git src \
    && ( cd src/ && git checkout ${IDG_VERSION} ) \
    && mkdir build && cd build \
    && cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DPORTABLE=ON ../src \
    && ninja install \
    && cd / && rm -rf idg

# Build EveryBeam
# NOTE: The recent (Mar 2024) version of WSClean we use below
# wants EveryBeam >= v0.5.5, we use the latest release.
ENV EVERYBEAM_VERSION=v0.5.6

RUN mkdir /everybeam && cd /everybeam \
    && git clone https://git.astron.nl/RD/EveryBeam.git src \
    && ( cd src/ && git checkout ${EVERYBEAM_VERSION} ) \
    && mkdir build && cd build \
    && cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../src -DPYTHON_EXECUTABLE=/usr/bin/python3 \
    && ninja install \
    && cd / && rm -rf everybeam

# Install pip dependencies
RUN pip3 install \
    autosemver==0.5.5 \
    gcovr \
    h5py \
    jsonschema2rst \
    sphinx \
    sphinx-rtd-theme

# Build DP3
# This is tip of the master branch from 12/01/2024
ENV DP3_VERSION=f7b083a5489b6afe2cd8a781a792047430fff191

RUN mkdir /dp3 && cd /dp3 \
    && git clone https://git.astron.nl/RD/DP3.git src \
    && cd src \
    && git checkout ${DP3_VERSION} \
    && git submodule update --init --recursive \
    && mkdir build && cd build \
    && cmake -DCMAKE_INSTALL_PREFIX=/usr .. \
    && make -j4 install \
    && cd / && rm -rf dp3
ENV PYTHONPATH=/usr/local/lib/python3.10/site-packages

# Build WSClean
# This is the tip of the master branch from 10/04/2024
# This version contains a fix to wsclean-mp crashes with high values of
# -channels-out
ENV WSCLEAN_VERSION=daf969711d9d7f7f8e01ffcff493c7bd13d2fe3c

RUN mkdir /wsclean && cd /wsclean \
    && git clone https://gitlab.com/aroffringa/wsclean.git src \
    && cd src \
    && git checkout ${WSCLEAN_VERSION} \
    && git submodule update --init --recursive

RUN cd /wsclean \
    && mkdir build && cd build \
    && cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../src \
    && ninja install \
    && cd / && rm -rf wsclean

# Install WSRT Measures (extra casacore data, for integration tests)
# Note: The file on the ftp site is updated daily. When warnings regarding leap
# seconds appear, ignore them or regenerate the docker image.
RUN wget -nv -O /WSRT_Measures.ztar ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar \
    && mkdir -p /usr/share/casacore/data \
    && cd /usr/share/casacore/data \
    && tar xfz /WSRT_Measures.ztar \
    && rm /WSRT_Measures.ztar