-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile.centos-7
149 lines (120 loc) · 6.86 KB
/
Dockerfile.centos-7
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
FROM centos:7
ARG TERM=linux
ARG SCIDB_NAME=scidb
ARG SCIDB_LOG_LEVEL=WARN
ARG SHIM_VER=19.11.3
ENV SCIDB_VER=19.11 \
SCIDB_NAME=$SCIDB_NAME
ENV SCIDB_INSTALL_PATH=/opt/scidb/$SCIDB_VER
ENV PATH=$PATH:$SCIDB_INSTALL_PATH/bin
ARG SCIDB_SCRIPT_URL="https://downloads.paradigm4.com/community/$SCIDB_VER/install-scidb-ce.sh"
## Prep for systemd 1/2
ENV container docker
RUN ( cd /lib/systemd/system/sysinit.target.wants/; \
for i in *; \
do [ $i = systemd-tmpfiles-setup.service ] || rm --force $i; \
done ); \
rm --force /etc/systemd/system/*.wants/*; \
rm --force /lib/systemd/system/anaconda.target.wants/*; \
rm --force /lib/systemd/system/basic.target.wants/*; \
rm --force /lib/systemd/system/local-fs.target.wants/*; \
rm --force /lib/systemd/system/multi-user.target.wants/*; \
rm --force /lib/systemd/system/sockets.target.wants/*initctl*; \
rm --force /lib/systemd/system/sockets.target.wants/*udev*
VOLUME [ "/sys/fs/cgroup" ]
## Install dependencies
ARG DEVTOOLSET_URL=https://downloads.paradigm4.com/devtoolset-3/centos/7/sclo/x86_64/rh/devtoolset-3/scidb-devtoolset-3.noarch.rpm
RUN yum install --assumeyes $DEVTOOLSET_URL \
&& yum install --assumeyes \
devtoolset-3-toolchain \
gcc \
git \
log4cxx-devel \
openssl-devel \
patch \
protobuf-devel \
wget \
which \
&& yum clean all
## Get SciDB install script
RUN wget --no-verbose --output-document /install-scidb-ce.sh "$SCIDB_SCRIPT_URL"
## Run SciDB install script
RUN yes \
| bash /install-scidb-ce.sh \
&& yum install --assumeyes \
scidb-$SCIDB_VER-dev \
scidb-$SCIDB_VER-libboost-devel \
&& yum clean all
## Setup SSH
RUN echo 'StrictHostKeyChecking no' \
>> /etc/ssh/ssh_config \
&& ssh-keygen -f /root/.ssh/id_rsa -q -N "" \
&& cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
## Setup SciDB config file
COPY config.ini $SCIDB_INSTALL_PATH/etc/
RUN sed --in-place s/SCIDB_VER/$SCIDB_VER/ $SCIDB_INSTALL_PATH/etc/config.ini
## Setup PostgreSQL and SciDB
RUN echo "127.0.0.1:5432:$SCIDB_NAME:$SCIDB_NAME:` \
date +%s | sha256sum | base64 | head -c 32`" \
> /root/.pgpass \
&& chmod go-r /root/.pgpass \
&& chmod a+r $SCIDB_INSTALL_PATH/etc/config.ini \
&& ssh-keygen -A \
&& /usr/sbin/sshd \
&& sed --in-place \
s/\\.\\.\\.0/172.17.0.0/ \
/var/lib/pgsql/9.3/data/pg_hba.conf \
&& su --command=" \
/usr/pgsql-9.3/bin/pg_ctl start \
-D /var/lib/pgsql/9.3/data/ \
-s \
-w \
-t 300" \
postgres \
&& until su --command="/usr/pgsql-9.3/bin/pg_isready" postgres \
; do sleep 1 \
; done \
&& su --command=" \
$SCIDB_INSTALL_PATH/bin/scidbctl.py init-syscat $SCIDB_NAME \
--db-password ` \
cut --delimiter : --fields 5 /root/.pgpass`" \
postgres \
&& $SCIDB_INSTALL_PATH/bin/scidbctl.py init-cluster --force \
$SCIDB_NAME \
&& su --command=" \
/usr/pgsql-9.3/bin/pg_ctl stop \
-D /var/lib/pgsql/9.3/data/ \
-s \
-m fast" \
postgres \
&& sed --in-place \
s/log4j.rootLogger=INFO/log4j.rootLogger=$SCIDB_LOG_LEVEL/ \
$SCIDB_INSTALL_PATH/share/scidb/log4cxx.properties
RUN wget --no-verbose --output-document - \
https://github.com/Paradigm4/shim/archive/v$SHIM_VER.tar.gz \
| tar --extract --gzip --directory=/usr/local/src \
&& cd /usr/local/src/shim-$SHIM_VER \
&& make service \
&& openssl req \
-new \
-newkey rsa:4096 \
-days 3650 \
-nodes \
-x509 \
-subj "/C=US/ST=MA/L=Waltham/O=Paradigm4/CN=$(hostname)" \
-keyout /var/lib/shim/ssl_cert.pem \
2> /dev/null \
>> /var/lib/shim/ssl_cert.pem \
&& echo "tmp=/tmp" \
>> /var/lib/shim/conf
## Setup container entrypoint
COPY docker-entrypoint-centos-7.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
## Port | App
## -----+-----
## 1239 | SciDB iquery
## 8080 | SciDB Shim (HTTP)
## 8083 | SciDB Shim (HTTPS)
EXPOSE 1239 8080 8083
## Prep for systemd 2/2
RUN rm /etc/systemd/system/multi-user.target.wants/postfix.service