forked from tornaria/cocalc-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-no-agpl
273 lines (228 loc) · 7.92 KB
/
Dockerfile-no-agpl
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
FROM ubuntu:18.04
# This buids cocalc-docker, but with no external AGPL software (like RStudio) installed.
# It does include **cocalc itself** which is AGPL licensed. However, one may purchase
# an MIT-style license for cocalc if you want from SageMath, Inc.
MAINTAINER William Stein <[email protected]>
USER root
ARG BUILD_DATE
LABEL org.label-schema.build-date=$BUILD_DATE
# See https://github.com/sagemathinc/cocalc/issues/921
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV TERM screen
# So we can source (see http://goo.gl/oBPi5G)
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Ubuntu software that are used by CoCalc (latex, pandoc, sage, jupyter)
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
software-properties-common \
texlive \
texlive-latex-extra \
texlive-extra-utils \
texlive-xetex \
texlive-luatex \
texlive-bibtex-extra \
liblog-log4perl-perl
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
tmux \
flex \
bison \
libreadline-dev \
htop \
screen \
pandoc \
aspell \
poppler-utils \
net-tools \
wget \
git \
python \
python-pip \
make \
g++ \
sudo \
psmisc \
haproxy \
nginx \
yapf \
rsync \
tidy
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
vim \
bup \
inetutils-ping \
lynx \
telnet \
git \
emacs \
subversion \
ssh \
m4 \
latexmk \
libpq5 \
libpq-dev \
build-essential \
automake
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
gfortran \
dpkg-dev \
libssl-dev \
imagemagick \
libcairo2-dev \
libcurl4-openssl-dev \
graphviz \
smem \
octave \
python3-yaml \
python3-matplotlib \
python3-jupyter* \
python-matplotlib* \
python-jupyter* \
python-ipywidgets \
python-ipywidgets-doc \
python3-ipywidgets \
jupyter \
locales \
locales-all \
postgresql \
postgresql-contrib \
clang-format \
yapf \
yapf3 \
golang \
r-cran-formatr
# The Octave kernel.
RUN \
pip install octave_kernel
# Jupyter Lab
RUN \
pip install jupyterlab
# Build and install Sage -- see https://github.com/sagemath/docker-images
COPY scripts/ /tmp/scripts
RUN chmod -R +x /tmp/scripts
RUN adduser --quiet --shell /bin/bash --gecos "Sage user,101,," --disabled-password sage \
&& chown -R sage:sage /home/sage/
# make source checkout target, then run the install script
# see https://github.com/docker/docker/issues/9547 for the sync
RUN mkdir -p /usr/local/ \
&& /tmp/scripts/install_sage.sh /usr/local/ 8.9 \
&& sync
RUN /tmp/scripts/post_install_sage.sh && rm -rf /tmp/* && sync
# See https://github.com/sagemathinc/cocalc-docker/issues/69
# Somewhat fragile below, but I really don't get why the first line
# isn't enough.
RUN chmod a+rx /usr/local/sage/local/share/jmol \
&& chmod a+r -R /usr/local/sage/local/share/jmol \
&& chmod a+rx /usr/local/sage/local/share/jmol/applet*
# Install sage scripts system-wide
RUN echo "install_scripts('/usr/local/bin/')" | sage
# Install SageTex
RUN \
sudo -H -E -u sage sage -p sagetex \
&& cp -rv /usr/local/sage/local/share/texmf/tex/latex/sagetex/ /usr/share/texmf/tex/latex/ \
&& texhash
# Install LEAN proof assistant
RUN \
export VERSION=3.4.1 \
&& mkdir -p /opt/lean \
&& cd /opt/lean \
&& wget https://github.com/leanprover/lean/releases/download/v$VERSION/lean-$VERSION-linux.tar.gz \
&& tar xf lean-$VERSION-linux.tar.gz \
&& rm lean-$VERSION-linux.tar.gz \
&& rm -f latest \
&& ln -s lean-$VERSION-linux latest \
&& ln -s /opt/lean/latest/bin/lean /usr/local/bin/lean
# Install all aspell dictionaries, so that spell check will work in all languages. This is
# used by cocalc's spell checkers (for editors). This takes about 80MB, which is well worth it.
RUN \
apt-get update \
&& apt-get install -y aspell-*
# Install Node.js and LATEST version of npm
RUN \
wget -qO- https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs libxml2-dev libxslt-dev \
&& /usr/bin/npm install -g npm
# Install Julia
ARG JULIA=1.2.0
RUN cd /tmp \
&& wget https://julialang-s3.julialang.org/bin/linux/x64/${JULIA%.*}/julia-${JULIA}-linux-x86_64.tar.gz \
&& tar xf julia-${JULIA}-linux-x86_64.tar.gz -C /opt \
&& rm -f julia-${JULIA}-linux-x86_64.tar.gz \
&& mv /opt/julia-* /opt/julia \
&& ln -s /opt/julia/bin/julia /usr/local/bin
# Install R Jupyter Kernel package into R itself (so R kernel works)
RUN echo "install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'httr', 'devtools', 'uuid', 'digest', 'IRkernel'), repos='https://cloud.r-project.org')" | sage -R --no-save
RUN echo "install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'httr', 'devtools', 'uuid', 'digest', 'IRkernel'), repos='https://cloud.r-project.org')" | R --no-save
# Commit to checkout and build.
ARG commit=HEAD
# Pull latest source code for CoCalc and checkout requested commit (or HEAD)
RUN \
git clone https://github.com/sagemathinc/cocalc.git \
&& cd /cocalc && git pull && git fetch origin && git checkout ${commit:-HEAD}
# Build and install all deps
# CRITICAL to install first web, then compute, since compute precompiles all the .js
# for fast startup, but unfortunately doing so breaks ./install.py all --web, since
# the .js files laying around somehow mess up cjsx loading.
RUN \
cd /cocalc/src \
&& . ./smc-env \
&& ./install.py all --web \
&& ./install.py all --compute \
&& rm -rf /root/.npm /root/.node-gyp/
# Install code into Sage
RUN cd /cocalc/src && sage -pip install --upgrade smc_sagews/
RUN echo "umask 077" >> /etc/bash.bashrc
# Install some Jupyter kernel definitions
COPY kernels /usr/local/share/jupyter/kernels
# Configure so that R kernel actually works -- see https://github.com/IRkernel/IRkernel/issues/388
COPY kernels/ir/Rprofile.site /usr/local/sage/local/lib/R/etc/Rprofile.site
# Move aside sage environment python3; this is needed for use of python3 from sagews
RUN \
cd /usr/local/sage/local/bin \
&& mv python3 python3-bkb
# Build a UTF-8 locale, so that tmux works -- see https://unix.stackexchange.com/questions/277909/updated-my-arch-linux-server-and-now-i-get-tmux-need-utf-8-locale-lc-ctype-bu
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
# Install IJulia kernel
#RUN echo '\
#ENV["JUPYTER"] = "/usr/local/bin/jupyter"; \
#ENV["JULIA_PKGDIR"] = "/opt/julia/share/julia/site"; \
#Pkg.init(); \
#Pkg.add("IJulia");' | julia \
# && mv -i "$HOME/.local/share/jupyter/kernels/julia-0.6" "/usr/local/share/jupyter/kernels/"
### Configuration
COPY login.defs /etc/login.defs
COPY login /etc/defaults/login
COPY nginx.conf /etc/nginx/sites-available/default
COPY haproxy.conf /etc/haproxy/haproxy.cfg
COPY run.py /root/run.py
COPY bashrc /root/.bashrc
## Xpra backend support -- we have to use the debs from xpra.org,
## Since the official distro packages are ancient.
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y xvfb websockify curl \
&& curl https://xpra.org/gpg.asc | apt-key add - \
&& echo "deb http://xpra.org/ bionic main" > /etc/apt/sources.list.d/xpra.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y xpra
## X11 apps to make x11 support useful.
## Will move this up in Dockerfile once stable.
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y x11-apps dbus-x11 \
xdotool xclip x11-xkb-utils
# CoCalc Jupyter widgets
RUN \
pip install --no-cache-dir ipyleaflet
RUN \
pip3 install --no-cache-dir ipyleaflet
CMD /root/run.py
EXPOSE 80 443