Skip to content

Commit

Permalink
Docker (#48)
Browse files Browse the repository at this point in the history
* Added CMAKE BUILD TYPE flag for potential speed up as per CGAL compile message

* Added docker build instructions

* Updated reference to dockerhub image
  • Loading branch information
Jimbles authored Jun 1, 2020
1 parent 86bff6a commit 14f1442
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
output/
examples/
MATLAB/
test/
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:bionic

# Mount volumes - these are in root to make it easier to type
# and to avoid confusion between those included in the Mesher directory

VOLUME /output
VOLUME /input

RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
libcgal-dev \
libcgal-qt5-dev \
libglu1-mesa \
libglu1-mesa-dev \
libxi-dev \
libxmu-dev

# Copy repo and make dirs
COPY . /Mesher

WORKDIR /Mesher
RUN mkdir build && mkdir output

# remove test from cmake list
RUN sed -i 's/^\(add_subdirectory(test).*\)/#\1/g' CMakeLists.txt

WORKDIR /Mesher/build
RUN cmake .. && make
WORKDIR /Mesher

#RUN echo "BUILD DONE. CHECKING MESHER RUNS"
#RUN ./bin/mesher -i inputs/input.inr -e inputs/Electrodes.txt -p inputs/params.txt

RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENTRYPOINT [ "./bin/mesher" ]
# default run with example inputs inside the container to demonstrate its working
CMD ["-i", "inputs/input.inr", "-e", "inputs/Electrodes.txt", "-p", "inputs/params.txt"]

# To run the Mesher, you need to mount the volumes and then direct the mesher to look into the correct directories e.g.:
# docker run --rm -v ~/Mesher/inputs2:/input -v ~/Mesher/output2:/output mesher -i /input/input.inr -e /input/Electrodes.txt -p /input/params.txt -d /output/ -o testing

52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ EIT-MESHER is C++ software, based on the CGAL library, which generates high qual

Examples for using the EIT-MESHER outputs with common EIT and DOT solvers are given in [solvers examples](examples/solvers)


## Build instructions (tested on Ubuntu 16, 17, 18)

* Install dependencies
Expand Down Expand Up @@ -71,6 +70,57 @@ Example:
```bash
./bin/mesher -i inputs/input.inr -e inputs/Electrodes.txt -p inputs/params.txt
```

Produces the following mesh as viewed in paraview

![Brain Example](examples/brain/figures/brain_PV.png)

## Docker instructions (for Ubuntu 19&20+)

EIT-MESHER can be built in a container to install on newer linux installations. Windows users require WSL2 for docker to work.

### Install container

The docker container can be obtained using two different methods:

* Build container from source (`mesher` is a name of your choice):

```bash
docker build -t mesher .
```

* Pull image directly from dockerhub without having to build

```bash
docker pull doctorjimbles/eit-mesher
```

### Running Mesher from container

To test it is working run the container with no inputs, this will call the mesher with defaults which runs the single example included in the container:

```bash
docker run --rm mesher
```

The `--rm` flag removes the container after its done to prevent having lots of unnecessary container IDs.

The mesher can then be called with the parameter arguments as normal **Note** these are files *inside* the container.

```bash
docker run --rm mesher -i inputs/input.inr -e inputs/Electrodes.txt -p inputs/params.txt
```

* Using your own data - mounting volumes

The container has two volumes `/input` and `/output` which can be mounted to a directory on the host using the `-v` flag. So for example with the `MESHER` repository on the home dir:

```bash
docker run --rm -v ~/Mesher/inputs:/input -v ~/Mesher/output:/output mesher
```

The mesher can then finally be called by combining the volume definitions and the parameters. **Note** The directories must be with respect to the container file structure

```bash
docker run --rm -v ~/Mesher/inputs:/input -v ~/Mesher/output:/output mesher -i /input/input.inr -e /input/Electrodes.txt -p /input/params.txt -d /output/ -o dockertest
```

0 comments on commit 14f1442

Please sign in to comment.