FROM opensuse/leap

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

WORKDIR /app
COPY . /app

RUN zypper update 
RUN zypper install -y python3-devel python3-numpy  \
	python3-sympy python3-matplotlib python3-scipy \
	libboost_iostreams1_66_0-devel libboost_numpy-py3-1_66_0-devel  \
	libboost_python-py3-1_66_0-devel libboost_random1_66_0-devel \
	libnetcdf_c++-devel libnetcdf_c++4-devel libnetcdf_c++-devel  \
	suitesparse-devel \
	git gcc gcc-c++ scons
RUN git clone https://github.com/esys-escript/esys-escript.github.io --depth 1 /app/escript
RUN cd /app/escript && scons options_file=scons/templates/opensuse_py3_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 cd /app/escript && ./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"]