FROM fedora

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

WORKDIR /app
COPY . /app

RUN yum update -y
RUN yum install -y python3 \
	python3-devel python3-scipy python3-matplotlib python3-sympy \
	boost-devel boost-python3 boost-numpy3 boost-iostreams boost-random \
	netcdf-devel netcdf-cxx netcdf-cxx-devel netcdf-cxx4 netcdf-cxx4-devel \
	suitesparse-devel \
	gcc-c++ scons git
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/fedora_py3_options.py -j`nproc` \
	netcdf='no' umfpack=1 build_full || cat config.log
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 '-t16'
RUN useradd -ms /bin/bash appuser
RUN run-escript /app/escript/scripts/release_sanity.py
RUN rm -rf *

CMD ["/bin/bash"]
