Skip to content

Instantly share code, notes, and snippets.

@bakirillov
Created September 14, 2021 17:46
Show Gist options
  • Save bakirillov/a276aaa3b5c0229e78499c2d1a34b0dd to your computer and use it in GitHub Desktop.
Save bakirillov/a276aaa3b5c0229e78499c2d1a34b0dd to your computer and use it in GitHub Desktop.
A Dockerfile for using firedrake with jupyter notebook and stuff
FROM firedrakeproject/firedrake:latest
USER root
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update && apt-get -y update
RUN apt-get install -y build-essential python3.6 python3-pip python3-dev
RUN pip3 -q install pip --upgrade
RUN pip3 install jupyter
RUN pip3 install matplotlib
RUN pip3 install numpy
RUN pip3 install scipy
RUN pip3 install pandas
WORKDIR /home/
RUN mkdir projects
WORKDIR /home/projects
RUN mkdir outside
ENV TINI_VERSION v0.6.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--"]
RUN python3 -c 'oh = open("run.sh", "w");oh.write("#!/bin/sh\n\nsource /home/firedrake/firedrake/bin/activate\nipython kernel install --user --name=firedrake\njupyter notebook --port=8888 --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token=\"\" --NotebookApp.password=\"\"\n");oh.close();'
CMD ["sh", "run.sh"]
1. Build the docker image with 'docker build -t ./ fjd';
2. Make a directory (e.g. outside) to use as a volume (so you can write notebooks under the image's jupyter and read them in your local env);
3. Run the docker image as 'docker run -v PATH_TO_YOUR_OUTSIDE_DIRECTORY:/home/projects/outside -p 8889:8888 fjd';
4. Go to "http://127.0.0.1:8889/tree/outside";
5. Create your notebooks using the "firedrake" environment (still provides everything else installed, and python3);
6. Don't forget to 'docker stop' the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment