FROM ubuntu:20.04

RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
    apt-get install -y \
    git \
    cmake \
    build-essential \
    g++ \
    pkg-config \
    casacore-data casacore-dev \
    libblas-dev liblapack-dev \
    python3 \
    libpython3-dev \
    libboost-date-time-dev libboost-test-dev \
    libboost-program-options-dev libboost-system-dev libboost-filesystem-dev \
    libcfitsio-dev \
    libfftw3-dev \
    libgsl-dev \
    libhdf5-dev \
    libopenmpi-dev \
    pkg-config \
    python3-dev python3-numpy \
    python3-sphinx \
    python3-pip \
    saods9 \
    wget

# Install EveryBeam
RUN mkdir /external && cd /external && git clone https://git.astron.nl/RD/EveryBeam.git && \
  mkdir /external/EveryBeam/build && cd /external/EveryBeam/build && cmake ../ && make install -j`nproc`

# Install Dysco
RUN cd /external && git clone https://github.com/aroffringa/dysco.git && \
  mkdir /external/dysco/build && cd /external/dysco/build && cmake ../ && make install -j`nproc`

# Install IDG
RUN cd /external && git clone https://git.astron.nl/RD/idg.git && \
  mkdir /external/idg/build && cd /external/idg/build && cmake ../ && make install -j`nproc`

# WSClean
ADD . /src
WORKDIR /src

RUN \
  mkdir /build && \
  cd /build && \
  cmake ../src && \
  make -j`nproc` && \
  make install && \
  wsclean --version
  
