-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenerate.sh
More file actions
executable file
·223 lines (201 loc) · 6.29 KB
/
generate.sh
File metadata and controls
executable file
·223 lines (201 loc) · 6.29 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
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
#!/bin/bash
function common_scripts() {
cat <<'EOF'
eval $(opam config env) && \
\
opam update && \
opam upgrade -y && \
(opam install -y batteries lwt_ssl tls 'cohttp>=0.22.0' || :) && \
opam install -y \
num \
'core>=v0.9.0' \
'async>=v0.9.0' \
lacaml \
slap \
lbfgs \
ocephes \
oml \
gsl \
gpr \
fftw3 \
'cairo2>=0.5' \
archimedes \
mysql \
'mariadb>=0.8.1' \
postgresql \
sqlite3 \
ocurl \
'oasis>=0.4.0' && \
\
: install libsvm && \
curl -L https://bitbucket.org/ogu/libsvm-ocaml/downloads/libsvm-ocaml-0.9.3.tar.gz \
-o /tmp/libsvm-ocaml-0.9.3.tar.gz && \
tar zxf /tmp/libsvm-ocaml-0.9.3.tar.gz -C /tmp && \
( \
cd /tmp/libsvm-ocaml-0.9.3 && \
oasis setup && \
./configure --prefix=$(opam config var prefix) && \
make && \
make install \
) && \
rm -rf /tmp/libsvm-ocaml-0.9.3.tar.gz /tmp/libsvm-ocaml-0.9.3 && \
\
: install tensorflow && \
curl -L "https://github.com/LaurentMazare/tensorflow-ocaml/archive/0.0.10.1.tar.gz" \
-o /tmp/tensorflow-ocaml-0.0.10.1.tar.gz && \
tar zxf /tmp/tensorflow-ocaml-0.0.10.1.tar.gz -C /tmp && \
( \
cd /tmp/tensorflow-ocaml-0.0.10.1 && \
sed -i 's/(no_dynlink)//' src/wrapper/jbuild && \
sed -i 's/(modes (native))//' src/wrapper/jbuild \
) && \
opam pin add -y /tmp/tensorflow-ocaml-0.0.10.1 && \
rm -rf /tmp/tensorflow-ocaml-0.0.10.1.tar.gz /tmp/tensorflow-ocaml-0.0.10.1 && \
\
find $HOME/.opam -regex '.*\.\(cmt\|cmti\|annot\|byte\)' -delete && \
rm -rf $HOME/.opam/archives \
$HOME/.opam/repo/default/archives \
$HOME/.opam/$OCAML_VERSION/man \
$HOME/.opam/$OCAML_VERSION/build && \
\
opam uninstall oasis
EOF
}
function centos_scripts() {
cat <<'EOF' > dockerfiles/$TAG/MariaDB.repo
[mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
cat <<EOF > dockerfiles/$TAG/Dockerfile
FROM akabe/iocaml:${TAG}
ENV TENSORFLOW_VERSION 1.1.0
ENV LD_LIBRARY_PATH /usr/lib:\$LD_LIBRARY_PATH
ENV LIBRARY_PATH /usr/lib:\$LIBRARY_PATH
ADD MariaDB.repo /etc/yum.repos.d/MariaDB.repo
RUN curl -L "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-\${TENSORFLOW_VERSION}.tar.gz" | sudo tar xz -C /usr && \\
sudo yum -y install epel-release && \\
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm && \\
sudo yum install -y --enablerepo=epel,nux-dextop \\
rsync \\
aspcud \\
bzip2 \\
gfortran \\
openssh-clients \\
blas-devel \\
lapack-devel \\
gsl-devel \\
libffi-devel \\
fftw-devel \\
libsvm-devel \\
cairo-devel \\
MariaDB-devel \\
postgresql-devel \\
sqlite-devel \\
libcurl-devel \\
gmp-devel \\
openssl-devel \\
ImageMagick \\
ffmpeg && \\
sudo ln -sf /usr/lib64/libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so && \\
\\
$(common_scripts) && \\
\\
sudo yum remove -y rsync aspcud bzip2 gfortran
ADD custom.css /home/opam/.jupyter/custom/custom.css
ADD notebook.json /home/opam/.jupyter/nbconfig/notebook.json
RUN sudo chown opam:opam -R /home/opam/.jupyter && \\
curl -L https://raw.githubusercontent.com/andrewray/iocaml/master/profile/static/custom/iocamlnblogo.png \\
-o /home/opam/.jupyter/custom/iocamlnblogo.png
EOF
}
function debian_scripts() {
cat <<'EOF' > dockerfiles/$TAG/iocaml-datascience-extra.list
deb http://ftp.uk.debian.org/debian jessie-backports main
deb [arch=amd64,i386] http://mirrors.accretive-networks.net/mariadb/repo/10.2/debian jessie main
EOF
cat <<EOF > dockerfiles/$TAG/Dockerfile
FROM akabe/iocaml:${TAG}
ENV TENSORFLOW_VERSION 1.1.0
ENV LD_LIBRARY_PATH /usr/lib:\$LD_LIBRARY_PATH
ENV LIBRARY_PATH /usr/lib:\$LIBRARY_PATH
ADD iocaml-datascience-extra.list /etc/apt/sources.list.d/iocaml-datascience-extra.list
RUN curl -L "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-\${TENSORFLOW_VERSION}.tar.gz" | sudo tar xz -C /usr && \\
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db && \\
sudo apt-get update && \\
sudo apt-get install -y \\
rsync \\
aspcud \\
bzip2 \\
gfortran \\
ssh \\
libffi-dev \\
libblas-dev \\
liblapack-dev \\
libgsl0-dev \\
libfftw3-dev \\
libsvm-dev \\
libcairo2-dev \\
libmariadb-dev \\
libpq-dev \\
libsqlite3-dev \\
libcurl4-openssl-dev \\
libgmp-dev \\
imagemagick \\
ffmpeg && \\
sudo ln -sf /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 /usr/lib/libmysqlclient.so && \\
\\
$(common_scripts) && \\
\\
sudo apt-get purge -y rsync aspcud bzip2 gfortran && \\
sudo apt-get autoremove -y && \\
sudo apt-get autoclean
ADD custom.css /home/opam/.jupyter/custom/custom.css
ADD notebook.json /home/opam/.jupyter/nbconfig/notebook.json
RUN sudo chown opam:opam -R /home/opam/.jupyter && \\
curl -L https://raw.githubusercontent.com/andrewray/iocaml/master/profile/static/custom/iocamlnblogo.png \\
-o /home/opam/.jupyter/custom/iocamlnblogo.png
EOF
}
echo "Generating dockerfiles/$TAG/Dockerfile (ALIAS=${ALIAS[@]})..."
rm -rf dockerfiles/$TAG
mkdir -p dockerfiles/$TAG
cat <<'EOF' > dockerfiles/$TAG/custom.css
.CodeMirror pre, .output pre {
font-family: "Ricty Diminished Discord", "Ricty Diminished", "Lucida Console", Monaco, monospace;
}
#ipython_notebook img {
display: block;
background: url(iocamlnblogo.png) no-repeat;
background-size: contain;
width: 205px;
height: 33px;
padding-left: 205px;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#ipython_notebook {
height: 40px !important;
}
EOF
cat <<'EOF' > dockerfiles/$TAG/notebook.json
{
"CodeCell": {
"cm_config": {
"indentUnit": 2,
"lineNumbers": true,
"autoCloseBrackets": true
}
}
}
EOF
if [[ "$OS" =~ ^centos: ]]; then
centos_scripts
elif [[ "$OS" =~ ^debian: ]]; then
debian_scripts
else
echo -e "\033[31m[ERROR] Unknown base image: ${OS}\033[0m"
exit 1
fi