Skip to content

Commit 3b6c2f4

Browse files
committed
Add "slim" version
+ wipe all but Numerics/Core matlab archives before installation + manually remove a lot of GUI-related libraries and resources: - libQt - map tiles - non-english localization - libcef (chrome embedded) - opengl* - jxbrowser - web-resources for various matlab toolboxes
1 parent 5e0c0f1 commit 3b6c2f4

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

matlab/slim/Dockerfile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM ubuntu:bionic
2+
3+
MAINTAINER Guillaume Flandin <g.flandin@ucl.ac.uk>
4+
5+
RUN apt-get update \
6+
&& apt-get -y install unzip libxt6 wget \
7+
&& apt-get clean \
8+
&& rm -rf \
9+
/tmp/hsperfdata* \
10+
/var/*/apt/*/partial \
11+
/var/lib/apt/lists/* \
12+
/var/log/apt/term*
13+
14+
# Install MATLAB MCR in /opt/mcr/
15+
# To save space we are removing all archives except Core and Numerics, and
16+
# we're kiling some of the larger blobs in the mcr as wel: Qt5 and cuda-related
17+
# libraries and map tiles. This list could be amended over time.
18+
ENV MATLAB_VERSION R2018b
19+
ENV MCR_VERSION v95
20+
RUN mkdir /opt/mcr_install \
21+
&& mkdir /opt/mcr \
22+
&& wget -P /opt/mcr_install --progress=bar:force https://www.mathworks.com/supportfiles/downloads/${MATLAB_VERSION}/deployment_files/${MATLAB_VERSION}/installers/glnxa64/MCR_${MATLAB_VERSION}_glnxa64_installer.zip \
23+
&& unzip -q /opt/mcr_install/MCR_${MATLAB_VERSION}_glnxa64_installer.zip -d /opt/mcr_install \
24+
&& rm /opt/mcr_install/archives/*GPU* \
25+
&& rm /opt/mcr_install/archives/*Hadoop* \
26+
&& rm /opt/mcr_install/archives/*Java* \
27+
&& rm /opt/mcr_install/archives/*MPS* \
28+
&& rm /opt/mcr_install/archives/*NET* \
29+
&& rm /opt/mcr_install/archives/*Web_Apps* \
30+
&& /opt/mcr_install/install -destinationFolder /opt/mcr -agreeToLicense yes -mode silent \
31+
&& rm -rf /opt/mcr_install /tmp/* \
32+
&& rm -rf /opt/mcr/${MCR_VERSION}/etc \
33+
&& rm -rf /opt/mcr/${MCR_VERSION}/bin/glnxa64/libQt5* \
34+
&& rm -rf /opt/mcr/${MCR_VERSION}/bin/glnxa64/qtwebengine* \
35+
&& rm -rf /opt/mcr/${MCR_VERSION}/mcr/toolbox/matlab/maps \
36+
&& rm -rf /opt/mcr/${MCR_VERSION}/resources/*/ja_JP \
37+
&& rm -rf /opt/mcr/${MCR_VERSION}/resources/*/ko_KR \
38+
&& rm -rf /opt/mcr/${MCR_VERSION}/resources/*/zh_CN \
39+
&& rm -rf /opt/mcr/${MCR_VERSION}/cefclient \
40+
&& rm -rf /opt/mcr/${MCR_VERSION}/bin/glnxa64/cef_* \
41+
&& rm -rf /opt/mcr/${MCR_VERSION}/sys/opengl \
42+
&& rm -rf /opt/mcr/${MCR_VERSION}/sys/jxbrowser \
43+
&& rm -rf /opt/mcr/${MCR_VERSION}/java/jarext/jxbrowser* \
44+
&& rm -rf /opt/mcr/${MCR_VERSION}/sys/tex \
45+
&& rm -rf /opt/mcr/${MCR_VERSION}/sys/java/jre/glnxa64/jre/lib/amd64/libjfxwebkit.so \
46+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/matlab/datools \
47+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/matlab/codetools \
48+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/matlab/uitools \
49+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/matlab/system \
50+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/matlab/codeanalysis \
51+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/matlab/pathdataservice \
52+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/coder \
53+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/glee \
54+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/simulink \
55+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/shared/dastudio \
56+
&& rm -rf /opt/mcr/${MCR_VERSION}/toolbox/shared/mlreportgen
57+
58+
# Install SPM Standalone in /opt/spm12/
59+
ENV SPM_VERSION 12
60+
ENV SPM_REVISION r7487
61+
ENV LD_LIBRARY_PATH /opt/mcr/${MCR_VERSION}/runtime/glnxa64:/opt/mcr/${MCR_VERSION}/bin/glnxa64:/opt/mcr/${MCR_VERSION}/sys/os/glnxa64:/opt/mcr/${MCR_VERSION}/sys/opengl/lib/glnxa64
62+
ENV MCR_INHIBIT_CTF_LOCK 1
63+
ENV SPM_HTML_BROWSER 0
64+
# Running spm once with "function exit" tests the succesfull installation *and*
65+
# extracts the ctf archive which is necessary if singularity is going to be
66+
# used later on, because singularity containers are read-only.
67+
RUN wget -P /opt --progress=bar:force https://www.fil.ion.ucl.ac.uk/spm/download/restricted/bids/spm${SPM_VERSION}_${SPM_REVISION}_Linux_${MATLAB_VERSION}.zip \
68+
&& unzip -q /opt/spm${SPM_VERSION}_${SPM_REVISION}_Linux_${MATLAB_VERSION}.zip -d /opt \
69+
&& rm -f /opt/spm${SPM_VERSION}_${SPM_REVISION}_Linux_${MATLAB_VERSION}.zip \
70+
&& find /opt/spm${SPM_VERSION}/ -name '*mexw32*' -name '*mexw64*' -name '*mexmaci64*' -delete \
71+
&& /opt/spm${SPM_VERSION}/spm${SPM_VERSION} function exit \
72+
&& chmod +x /opt/spm${SPM_VERSION}/${SPM_VERSION}
73+
74+
# Configure entry point
75+
ENTRYPOINT ["/opt/spm12/spm12"]
76+
CMD ["--help"]

0 commit comments

Comments
 (0)