FROM kernsuite/base:3
RUN docker-apt-install \
    clang \
    casacore-data \
    cmake \
    flex \
    bison \
    libblas-dev \
    liblapack-dev \
    libcfitsio3-dev \
    wcslib-dev \
    libfftw3-dev \
    gfortran \
    libncurses5-dev \
    libreadline6-dev \
    libhdf5-serial-dev \
    libboost-dev \
    libboost-python-dev \
    python-numpy \
    python3-numpy
ADD . /code
RUN useradd -ms /bin/bash casacore
RUN chown casacore.casacore /code
USER casacore
RUN mkdir /code/build
WORKDIR /code/build
RUN cmake .. \
    -DUSE_FFTW3=ON \
    -DBUILD_TESTING=ON \
    -DUSE_OPENMP=OFF \
    -DUSE_HDF5=ON \
    -DBUILD_PYTHON=ON \
    -DBUILD_PYTHON3=ON \
    -DBOOST_PYTHON3_LIBRARY_NAME=python-py35 \
    -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \
    -DDATA_DIR=/usr/share/casacore/data \
    -DCMAKE_C_COMPILER=/usr/bin/clang \
    -DCMAKE_CXX_COMPILER=/usr/bin/clang++
RUN make -j4
USER root
RUN make install
USER casacore

