FROM ubuntu:latest

LABEL maintainer="a.ellery@uq.edu.au"

WORKDIR /app
COPY . /app

ENV UBUNTU_FRONTEND=noninteractive
# RUN apt-get update 
RUN apt-get install -y python3-dev python3-numpy \
	 python3-sympy python3-matplotlib python3-scipy \
	 libboost-python-dev libboost-random-dev libboost-numpy-dev \
	 libnetcdf-dev libnetcdf-cxx-legacy-dev libnetcdf-c++4-dev \
	 libsuitesparse-dev scons lsb-release \
	 git diff
WORKDIR escript
RUN git clone https://github.com/esys-escript/esys-escript.github.io .
RUN scons options_file=scons/templates/focal_options.py -j`nproc` build_full
ENV LD_LIBRARY_PATH=/app/escript/lib:$LD_LIBRARY_PATH
ENV PYTHONPATH=/app/escript:$PYTHONPATH
ENV PATH=/app/escript/bin:$PATH
RUN ./utest.sh /app/escript/build '-t7'
RUN useradd -ms /bin/bash appuser
RUN run-escript /app/escript/scripts/release_sanity.py
RUN rm -rf *

CMD ["/bin/bash"]
