Skip to content

Commit

Permalink
Merge pull request #138 from Noam-Elisha/master
Browse files Browse the repository at this point in the history
Added Dockerfile to build WE-UQ Image
  • Loading branch information
fmckenna authored Nov 29, 2023
2 parents e5a70e9 + 8b7aebd commit f833bab
Showing 1 changed file with 199 additions and 0 deletions.
199 changes: 199 additions & 0 deletions DockerfileWE
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
FROM ubuntu:bionic

SHELL ["/bin/bash", "-c"]

ARG versionWEUQ=xxxxxx
ARG versionSimCenterCommon=v23.09
ARG versionSimCenterBackend=v23.09
ARG versionOpenSees=v3.5.0

WORKDIR /simcenter

#
# Install Qt
# note: utilizes following for Qt: https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.15.2-bionic
#

RUN apt-get update \
&& apt-get install -y sudo \
&& sudo apt install -y software-properties-common cmake \
&& sudo add-apt-repository -y ppa:beineri/opt-qt-5.15.2-bionic \
&& sudo apt update \
&& sudo apt-get install -y build-essential freeglut3-dev python3-pip git \
&& sudo python3 -m pip install -U pip \
&& pip3 install conan==1.60.1 \
&& sudo apt-get install -y qt515base qt5153d qt515charts-no-lgpl qt515webengine

#
# Install cmake needed for VTK
#

RUN sudo apt remove cmake -y \
&& sudo apt purge --auto-remove cmake -y \
&& sudo apt-get install -y wget \
&& wget http://www.cmake.org/files/v3.15/cmake-3.15.0.tar.gz \
&& tar xf cmake-3.15.0.tar.gz \
&& cd cmake-3.15.0 \
&& ./configure \
&& make \
&& sudo make install \
&& rm -fr /simcenter/cmake*

#
# Install VTK needed for WE-UQ frontend
#

RUN wget https://www.vtk.org/files/release/9.2/VTK-9.2.6.tar.gz \
&& tar -zxBf VTK-9.2.6.tar.gz \
&& cd VTK-9.2.6; mkdir build; cd build \
&& source /opt/qt515/bin/qt515-env.sh \
&& cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DVTK_GROUP_ENABLE_Qt=YES -DVTK_VTK_Group_Qt=YES \
-DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES \
-DQt5_DIR:PATH=/usr/local/qt/lib/cmake/Qt5 \
&& make \
&& sudo make install \
&& rm -fr /simcenter/VTK*

#
# Build WE-UQ frontend
# && git clone -b $versionEE --single-branch https://github.com/NHERI-SimCenter/WE-UQ.git \

RUN source /opt/qt515/bin/qt515-env.sh \
&& git clone https://github.com/NHERI-SimCenter/SimCenterCommon.git \
&& git clone https://github.com/NHERI-SimCenter/WE-UQ.git \
&& cd WE-UQ \
&& mkdir build \
&& cd build \
&& conan install .. --build missing \
&& source /opt/qt515/bin/qt515-env.sh \
&& qmake ../WE-UQ.pro \
&& make \
&& rm -fr .obj *.o *.cpp \
&& rm -fr /simcenter/SimCenterCommon


#
# Install openfoam - version 10
# NOTE: missing adding source /opt/openfoam10/etc/bashrc into bashrc
# ===> will add to application
#

RUN sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc" \
&& sudo add-apt-repository http://dl.openfoam.org/ubuntu \
&& sudo apt-get update \
&& sudo apt-get -y install openfoam10

#
# Build OpenSees
# note: some stuff in there to get latest cmake as 3.10 not doing it
#

RUN sudo apt-get install -y cmake liblapack-dev libomp-dev libssl-dev apt-transport-https ca-certificates wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null \
&& sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
&& sudo apt-get update \
&& sudo apt-get install -y cmake gfortran gcc g++ \
&& git clone -b $versionOpenSees --single-branch https://github.com/OpenSees/OpenSees.git \
&& cd OpenSees \
&& mkdir build; cd build \
&& conan install .. --build missing \
&& cmake .. \
&& cmake --build . --config Release \
&& cmake --install . \
&& sudo mv ./lib/* /usr/local/lib \
&& cd ../..; rm -fr OpenSees

#
# Build Dakota
# note: dakota also needed more upto date cmake

RUN wget https://github.com/snl-dakota/dakota/releases/download/v6.15.0/dakota-6.15.0-public-src-cli.tar.gz \
&& sudo apt-get install -y libboost-dev libboost-all-dev libopenmpi-dev openmpi-bin xorg-dev libmotif-dev \
&& tar zxBf dakota-6.15.0-public-src-cli.tar.gz \
&& mv dakota-6.15.0-public-src-cli dakota-6.15.0 \
&& cd dakota-6.15.0 \
&& mkdir build; cd build \
&& cmake .. \
&& cmake --build . --config Release \
&& cmake --install . \
&& cd ../..; rm -fr dakot*


#
# Build SimCenter Backend Applications
# note: need newer gcc, gcc-10 which necessitates removing old conan
#

RUN git clone -b $versionSimCenterBackend https://github.com/NHERI-SimCenter/SimCenterBackendApplications.git \
&& cp ./SimCenterBackendApplications/modules/performUQ/SimCenterUQ/nataf_gsa/CMakeLists.txt.UBUNTU ./SimCenterBackendApplications/modules/performUQ/SimCenterUQ/nataf_gsa/CMakeLists.txt \
&& rm -fr ~/.conan \
&& sudo apt-get install -y liblapack-dev libomp-dev libssl-dev apt-transport-https ca-certificates \
&& sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& sudo apt-get update \
&& sudo apt-get install -y gcc-10 g++-10 gfortran-10 \
&& export CC=gcc-10 \
&& export CXX=g++-10 \
&& export FC=gfortran-10 \
&& conan remote add simcenter https://nherisimcenter.jfrog.io/artifactory/api/conan/simcenter \
&& cd SimCenterBackendApplications \
&& mkdir build \
&& cd build \
&& conan install .. --build missing \
&& cmake .. \
&& cmake --build . --config Release \
&& cmake --install . \
&& cd ../..

#
# Install python3.9
# note: need a later python3 for nheri-simcenter
# which we have to build from source!!!
#

RUN sudo apt-get install -y zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev libffi-dev libbz2-dev \
&& wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz \
&& tar -xf Python-3.9.6.tgz \
&& cd Python-3.9.6 \
&& ./configure --enable-optimizations \
&& sudo make install \
&& cd ..; rm -fr python* \
&& pip3 install nheri-simcenter

#
# Copy all files into correct locations for running & clean up
#

RUN cd WE-UQ/build \
&& cp -r ../Examples ./ \
&& cp -r ../../SimCenterBackendApplications/applications . \
&& rm -fr /simcenter/SimCenterBackendApplications \
&& rm -fr /simcenter/SimCenterCommon

#
# add following for the missing lib libQt5Core.so error that is related to running on some versions linux
# with an older kernel, seemingly need kernel >= 3.5 on host .. soln from Sal T. found in an AskUbuntu thread
#

RUN strip --remove-section=.note.ABI-tag /opt/qt515/lib/libQt5Core.so.5

#
# Finally add a new user simcenter as root cannot run the Qt app
#

RUN useradd -ms /bin/bash simcenter

USER simcenter










0 comments on commit f833bab

Please sign in to comment.