Skip to content

Commit abc9dfc

Browse files
author
Ben Mather
committed
Nicky's dockerfile
1 parent 1c79fef commit abc9dfc

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

Docker/Dockerfile-22.04

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# ------ DockerFile for running various scripts and codes
2+
# This is specifically for DockerDesktop 2.2
3+
FROM ubuntu:22.04
4+
5+
ENV DEBIAN_FRONTEND noninteractive
6+
7+
# set up environment.
8+
RUN apt-get update \
9+
&& apt-get install -y --no-install-recommends python3-pip \
10+
libnetcdf-dev \
11+
libgdal-dev \
12+
libgeos-dev \
13+
proj-data \
14+
python3-gdal \
15+
python3-dev \
16+
g++ \
17+
gfortran \
18+
ffmpeg \
19+
cmake \
20+
make \
21+
ghostscript \
22+
gmt-gshhg \
23+
gmt-dcw \
24+
gdal-bin \
25+
wget \
26+
software-properties-common \
27+
&& apt-get clean \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# install GMT from source. Default GMT is otherwise too old (6.0.0)
31+
# GMT can be downloaded from here: https://github.com/GenericMappingTools/gmt/releases/tag/6.4.0
32+
# COPY gmt-6.4.0-src.tar.gz /
33+
RUN wget https://github.com/GenericMappingTools/gmt/releases/download/6.4.0/gmt-6.4.0-src.tar.gz -O ~/gmt-6.4.0-src.tar.gz && \
34+
tar xvf ~/gmt-6.4.0-src.tar.gz \
35+
&& cp gmt-6.4.0/cmake/ConfigUserTemplate.cmake gmt-6.4.0/cmake/ConfigUser.cmake \
36+
&& mkdir gmt-6.4.0/build \
37+
&& cd gmt-6.4.0/build \
38+
&& cmake .. \
39+
&& cmake --build . \
40+
&& cmake --build . --target install \
41+
&& cd ../.. \
42+
&& rm ~/gmt-6.4.0-src.tar.gz && rm -r /gmt-6.4.0 \
43+
&& apt remove cmake -y \
44+
&& apt remove make -y
45+
46+
# install pygplates!
47+
# Copy both amd64 and arm64 versions, and then check which one we need
48+
# PyGPlates can be downloaded from here: https://www.earthbyte.org/download-pygplates-0-36/
49+
COPY pygplates_0.36.0_py310_ubuntu-22.04-*64.deb /
50+
51+
## Check the architecture, and install the correct pygplates
52+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) \
53+
&& apt-get update \
54+
&& apt install -y -f ./pygplates_0.36.0_py310_ubuntu-22.04-$arch.deb \
55+
&& apt-get clean \
56+
&& rm -rf /var/lib/apt/lists/* \
57+
&& rm /pygplates_0.36.0_py310_ubuntu-22.04-*.deb
58+
59+
60+
# set pythonpath
61+
ENV PYTHONPATH=$PYTHONPATH:/usr/lib
62+
63+
# install Cython as root, and also set python = python3
64+
RUN pip3 install --no-cache-dir Cython \
65+
&& cd "$(dirname $(which python3))" \
66+
&& ln -s idle3 idle \
67+
&& ln -s pydoc3 pydoc \
68+
&& ln -s python3 python \
69+
&& ln -s python3-config python-config \
70+
&& echo alias ls="'"'ls --color=auto'"'" >> /etc/profile \
71+
&& echo "PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> /etc/profile
72+
73+
# ------
74+
# add user
75+
ENV NB_USER jovyan
76+
ENV NB_HOME /home/$NB_USER
77+
RUN useradd -m -s /bin/bash -N $NB_USER -g users \
78+
&& mkdir -p /$NB_HOME/workspace \
79+
&& chown -R $NB_USER:users $NB_HOME
80+
VOLUME $NB_HOME/workspace
81+
82+
# switch user
83+
USER $NB_USER
84+
WORKDIR $NB_HOME
85+
86+
# ------
87+
# install various python packages
88+
# --no-cache-dir (and doing it all in one RUN command) is my attempt to try and reduce the image size
89+
RUN pip3 install --no-cache-dir shapely \
90+
&& pip3 install --no-cache-dir pygmt \
91+
jupyterlab \
92+
pandas \
93+
xarray \
94+
numpy \
95+
matplotlib \
96+
scipy \
97+
datetime \
98+
fiona \
99+
geopandas \
100+
rioxarray \
101+
cartopy \
102+
PlateTectonicTools \
103+
gplately \
104+
stripy \
105+
moviepy \
106+
joblib \
107+
scikit-learn \
108+
pyyaml \
109+
pybacktrack \
110+
rtree \
111+
cmocean \
112+
&& pip3 install --no-cache-dir --upgrade numpy
113+
114+
ENV PATH "/$NB_HOME/.local/bin:${PATH}"
115+
# SHELL ["/bin/bash", "-l", "-c"]
116+
ENV SHELL /bin/bash
117+
118+
# ------ start command
119+
EXPOSE 8888
120+
CMD ["jupyter-lab", "--no-browser", "--ip=0.0.0.0"]

0 commit comments

Comments
 (0)