Skip to content

Commit

Permalink
Merge pull request #35 from aurora-multiphysics/fix-docker
Browse files Browse the repository at this point in the history
Fix docker build by installing Proteus on Ubuntu base image.
  • Loading branch information
lukethehuman authored Jul 8, 2024
2 parents bb2d063 + 74dc256 commit e755be5
Showing 1 changed file with 77 additions and 8 deletions.
85 changes: 77 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,86 @@
# cd docker
# docker build --rm -t proteus:latest .

# Get latest base MOOSE image
FROM idaholab/moose:latest
# Use Ubuntu as the base image
FROM ubuntu:22.04

# By default, two cores are used to compile
ARG compile_cores=2
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PROTEUS_DIR=/proteus
ENV MOOSE_DIR=/opt/moose
ENV MOOSE_JOBS=4

# Update and install dependencies
RUN apt-get update && \
apt-get install -y \
gcc \
g++ \
gfortran \
cmake \
bison \
flex \
git \
python3 \
python3-dev \
python-is-python3 \
python3-packaging \
openmpi-bin \
libopenmpi-dev \
libboost-all-dev \
libtirpc-dev \
autoconf \
automake \
python3-yaml \
libtool && \
# Set up the Proteus profile
echo "export CC=mpicc" > /root/.proteus_profile && \
echo "export CXX=mpicxx" >> /root/.proteus_profile && \
echo "export F90=mpif90" >> /root/.proteus_profile && \
echo "export F77=mpif77" >> /root/.proteus_profile && \
echo "export FC=mpif90" >> /root/.proteus_profile && \
echo "export MOOSE_DIR=$MOOSE_DIR" >> /root/.proteus_profile && \
echo "export PATH=\$PATH:$PROTEUS_DIR" >> /root/.proteus_profile && \
. /root/.proteus_profile

# Increase git buffer size and clone MOOSE repository
RUN git config --global http.postBuffer 524288000 && \
git config --global http.lowSpeedLimit 0 && \
git config --global http.lowSpeedTime 999999 && \
git clone --depth 1 https://github.com/idaholab/moose.git $MOOSE_DIR || \
{ echo "Retrying..."; sleep 5; git clone --depth 1 https://github.com/idaholab/moose.git $MOOSE_DIR; }

# Build PETSc
RUN cd $MOOSE_DIR && \
unset PETSC_DIR PETSC_ARCH && \
./scripts/update_and_rebuild_petsc.sh \
--CXXOPTFLAGS="-O3 -march=native" \
--COPTFLAGS="-O3 -march=native" \
--FOPTFLAGS="-O3 -march=native"

# Build libMesh
RUN cd $MOOSE_DIR && \
./scripts/update_and_rebuild_libmesh.sh --with-mpi

# Build WASP
RUN cd $MOOSE_DIR && \
./scripts/update_and_rebuild_wasp.sh

# Configure AD
RUN cd $MOOSE_DIR && \
./configure --with-derivative-size=81

# Copy Proteus source code
RUN git clone https://github.com/aurora-multiphysics/proteus.git

# Build Proteus
RUN cd /$WORKDIR && \
git clone https://github.com/aurora-multiphysics/proteus.git && \
cd proteus && \
make -j"$compile_cores"
RUN cd $PROTEUS_DIR && \
make -j $MOOSE_JOBS

# Set working directory
WORKDIR /proteus

# Set entrypoint
ENTRYPOINT ["/bin/bash"]

# Run tests
RUN cd /proteus && \
Expand Down

0 comments on commit e755be5

Please sign in to comment.