FROM ubuntu:22.04

ARG make_threads=4

ENV PRISM_DIR "/usr/uPOMDP/prism"
# uPOMDP working dir
ARG MAIN_DIR="/usr/uPOMDP/uPOMDP"
# Set Storm dir for pystorm.
ENV STORM_DIR "/usr/uPOMDP/storm"
# Tensorflow env flag to get package to work with current requirements.
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION "python"

ENV GRB_LICENSE_FILE "${MAIN_DIR}/gurobi.lic"

RUN set -eux && \
    apt-get update && \
    apt-get upgrade -yy && \
    apt-get install -yy build-essential git cmake libboost-all-dev libcln-dev libgmp-dev libginac-dev automake libglpk-dev libhwloc-dev libz3-dev libxerces-c-dev libeigen3-dev python3 python3-pip openjdk-17-jdk openjdk-17-jre

RUN set -eux && \
    mkdir -p ${STORM_DIR} && \
    cd ${STORM_DIR} && \
    git clone --depth 1 -b 1.8.1 https://github.com/moves-rwth/storm.git . && \
    mkdir -p build && \
    cd build && \
    cmake .. && \
    make -j ${make_threads}

WORKDIR ${PRISM_DIR}

RUN set -eux && \
    git clone --depth 1 -b v4.8.1 https://github.com/prismmodelchecker/prism.git . && \
    cd prism && \
    make -j ${make_threads} && \
    sh install.sh

WORKDIR ${MAIN_DIR}

RUN set -eux && \
    python3 -m pip install -U pip setuptools wheel
    
RUN set -eux && \
    pip install numpy==1.24.3 scipy==1.12.0 seaborn==0.11.2 pandas==1.4.1 joblib==1.4.0 mem-top==0.1.6 larq==0.13.3 pytest==7.1.1 transitions==0.8.11 tensorflow==2.10.1 mip==1.15.0 gurobipy==11.0.0 tqdm==4.66.1 pycddlib==2.1.7  scikit-learn==1.3.2  jinja2==3.1.3
   
RUN set -eux && \
    pip install git+https://github.com/moves-rwth/pycarl.git@2.2.0 && \
    pip install git+https://github.com/moves-rwth/stormpy.git@1.8.0

RUN git config --global --add safe.directory ${MAIN_DIR}
