-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Olender/issue_0042
Issue 0042 into NDF's spyro (Dockerfile and related environments)
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM firedrakeproject/firedrake:2023-09 AS spyro_base | ||
|
||
USER root | ||
RUN apt-get update \ | ||
&& apt-get -y dist-upgrade \ | ||
&& apt-get -y install gmsh patchelf \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
USER firedrake | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install wheel --upgrade | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install scipy | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install roltrilinos | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install ROL | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install matplotlib | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install segyio | ||
|
||
# spyro dependencies | ||
USER root | ||
RUN apt-get update && apt-get install -y libgmp3-dev libmpfr-dev libcgal-dev python3-tk | ||
USER firedrake | ||
# The PyPI SeismicMesh has bugs. It is better to install from GitHub | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install --no-dependencies git+https://github.com/krober10nd/SeismicMesh.git | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install pyamg | ||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install meshio | ||
|
||
FROM spyro_base AS spyro_release | ||
|
||
RUN . /home/firedrake/firedrake/bin/activate; pip install git+https://github.com/Olender/spyro-1.git | ||
|
||
FROM spyro_base AS spyro_development | ||
|
||
RUN . /home/firedrake/firedrake/bin/activate; pip3 install pytest | ||
WORKDIR /home/firedrake | ||
RUN echo "/home/firedrake/shared/spyro" >> /home/firedrake/firedrake/lib/python3.10/site-packages/shared.pth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## Docker images | ||
|
||
This directory presents a Dockerfile to provide images for release (user installation), and development/testing. The release image comes with the corresponding spyro version installed, while the development/testing image use the current spyro checkout. The latest spyro version is not installed in the development/testing image to avoid ambiguities during use. | ||
|
||
The build commands below assume that the working directory is the root of spyro. If your current working directory is different, you have to adjust the Dockerfile path. | ||
|
||
### Installing | ||
|
||
The Docker image may be used for installing spyro. The following command builds the release image: | ||
```` | ||
docker build -t runtag:1.0 --target spyro_release docker | ||
```` | ||
|
||
Then, the following commands gives access to a virtual environment with spyro: | ||
```` | ||
docker run -it runtag:1.0 | ||
. firedrake/bin/activate | ||
```` | ||
|
||
### Development/Testing | ||
|
||
The Dockerfile may also be used to create a development environment. First, clone the git repository and then build the development image: | ||
```` | ||
git clone https://github.com/Olender/spyro-1.git | ||
cd spyro-1 | ||
git checkout <your_branch> | ||
docker build -t devtag:1.0 -f docker/Dockerfile --target spyro_development docker | ||
```` | ||
|
||
Then, start a container and share your local repository: | ||
```` | ||
docker run -v $PWD:/home/firedrake/shared/spyro -it devtag:1.0 | ||
. firedrake/bin/activate | ||
```` | ||
|
||
For running the automated tests: | ||
```` | ||
cd shared/spyro/ | ||
python3 -m pytest --maxfail=1 test/ | ||
```` |