@@ -72,16 +72,57 @@ It also targets a much broader community, with the potential to
72
72
relieve the SageMath community from maintaining a custom solution.
73
73
On the other hand it's still relatively recent and quickly evolving
74
74
technology with less settled sustainability. Also the SageMath Cell
75
- has been optimized to be more reactive on startup and reduce
75
+ has been optimized to be more reactive on startup and reduceapt
76
76
resource consumption. Those optimizations have not yet been ported to
77
77
Thebe+binder.
78
78
79
79
See also `thebe.rst <thebe.rst >`_ for additional reader-oriented notes.
80
80
81
+ Extending the sagemath Docker image
82
+ -----------------------------------
83
+
84
+ The sample [`Dockerfile `](https://github.com/sagemath/sage-binder-env/blob/master/Dockerfile)
85
+ in this repository is based on the official `sagemath/sagemath ` Docker image. It includes
86
+ Sage itself, and all the software packages typically included in a standard Sage installation,
87
+ though not *everything * (in particular not optional Sage SPKGs, or other system software
88
+ packages).
89
+
90
+ So in order to install additional Sage SPKGs it is possible to include a line like
91
+
92
+ RUN sage -i <spkg-name>
93
+
94
+ in the `Dockerfile `. Note, due to a current shortcoming in the official Docker image it is
95
+ also necessary to install the `make ` system package before running `sage -i `. See the
96
+ next section.
97
+
98
+ Installing additional system packages
99
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
+
101
+ To add additional software packages a couple more steps are involved,
102
+ albeit relatively simple. The thing to understand about the `sagemath/sagemath ` image is
103
+ that by default it puts you in a user called `sage `, so in order to install system packages
104
+ it is necessary, when extending the image, to first switch back to the `root ` user.
105
+ Then, because the image is based on Ubuntu, the `apt-get ` command can be used to install
106
+ Ubuntu packages. The canonical way to do this in a `Dockerfile ` involves updating the
107
+ APT cache, installing the packages, and then cleaning up the APT cache again all within
108
+ a single command (this is in order to keep cache files out of the image):
109
+
110
+ USER root
111
+ RUN apt-get -qq update \
112
+ && apt-get -qq install -y --no-install-recommends <packages-to-install> \
113
+ && apt-get -qq clean
114
+ USER sage
115
+
116
+ Finally, just make sure toward the end of the `Dockerfile ` that you switch the image
117
+ user back to `sage ` (so that when users run the container they are not running it as
118
+ `root `.
119
+
120
+
81
121
Authors
82
122
-------
83
123
84
124
Nicolas M. Thiéry
125
+ E. Madison Bray
85
126
86
127
The demo notebooks for GAP, Singular, and Pari were written by the
87
128
authors of the respective kernels. See the
0 commit comments