Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (52 loc) · 2.92 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (52 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Combined image: Firedrake + G-ADOPT + pyGMT, no conda.
# Verified 3 Aug 2026 — all three import cleanly in one interpreter.
FROM firedrakeproject/firedrake-vanilla-default:2026.4.1
# These labels must be present at PUBLISH time, not added later. The
# org.opencontainers.image.source label is what links the package to the repo,
# and GitHub only grants the package the repo's access permissions if the link
# exists *before* the first publish. Linking afterwards keeps whatever
# permissions the package already had.
LABEL org.opencontainers.image.source="https://github.com/EarthByte/Geodynamics-pyGMT-tutorials" \
org.opencontainers.image.description="Firedrake + G-ADOPT + pyGMT for the Geodynamics-pyGMT teaching notebooks" \
org.opencontainers.image.licenses="BSD-3-Clause"
USER root
# Ubuntu 24.04 apt ships GMT 6.5.0 == pyGMT 0.19's minimum.
# Debian/Ubuntu provide only libgmt.so.6, so pyGMT needs the .so symlink.
# Resolve the multiarch directory rather than hardcoding x86_64-linux-gnu —
# this image is built for arm64 as well, where the path is aarch64-linux-gnu.
RUN apt-get update && apt-get install -y --no-install-recommends \
gmt gmt-dcw gmt-gshhg ghostscript \
&& rm -rf /var/lib/apt/lists/* \
&& lib="$(find /usr/lib -name 'libgmt.so.6*' -type f -print -quit)" \
&& ln -sf "$lib" "$(dirname "$lib")/libgmt.so" \
&& test -e "$(dirname "$lib")/libgmt.so"
RUN pip install --no-cache-dir \
gadopt pygmt xarray netCDF4 imageio imageio-ffmpeg \
jupyterlab notebook nbgitpuller
# pyGPlates, for T15. The wheel links against libGL even though nothing here
# draws anything, so libgl1 is not optional -- without it the import fails with
# "libGL.so.1: cannot open shared object file". Wheels exist for cp312 on both
# manylinux x86_64 and aarch64, which is what keeps this image multi-arch.
RUN apt-get update && apt-get install -y --no-install-recommends libgl1 \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir pygplates plate-model-manager
# The Muller et al. (2022) 1 Ga reconstruction, baked in at build time so the
# notebooks need no network. About 57 MB against a 7.5 GB image, and the
# alternative -- fetching at runtime -- would break both offline use and CI.
ENV GEODYN_PLATE_DIR=/opt/plate-model
RUN python3 -c "\
from plate_model_manager import PlateModelManager; \
m = PlateModelManager().get_model('muller2022', data_dir='/opt/plate-model'); \
m.get_rotation_model(); m.get_topologies()" \
&& chmod -R a+rX /opt/plate-model \
&& du -sh /opt/plate-model
# BinderHub requires a UID-1000 user that owns $HOME, and forbids running as root.
ARG NB_USER=jovyan
ARG NB_UID=1000
# Ubuntu 24.04 base images already ship a UID-1000 'ubuntu' user; remove it first.
RUN if id -u ${NB_UID} >/dev/null 2>&1; then userdel -r "$(id -un ${NB_UID})" || true; fi \
&& useradd -m -s /bin/bash -u ${NB_UID} ${NB_USER}
ENV HOME=/home/${NB_USER} \
PYGMT_USE_EXTERNAL_DISPLAY=false
WORKDIR ${HOME}
USER ${NB_USER}