-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
131 lines (112 loc) · 4.11 KB
/
Dockerfile
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
ARG IMAGE=store/intersystems/iris-community:2019.4.0.383.0
FROM ${IMAGE}
USER root
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
# https://stackoverflow.com/questions/8671308/non-interactive-method-for-dpkg-reconfigure-tzdata
RUN export DEBIAN_FRONTEND=noninteractive; \
export DEBCONF_NONINTERACTIVE_SEEN=true; \
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
apt-get update -qqy \
&& apt-get install -qqy --no-install-recommends \
tzdata
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# extra dependencies (over what buildpack-deps already includes)
RUN apt-get update && apt-get install -y --no-install-recommends \
tk-dev \
gcc \
openssl \
libssl1.1 \
libssl-dev \
libbz2-dev \
liblzma-dev \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHON_VERSION 3.6.7
RUN set -ex \
\
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--enable-loadable-sqlite-extensions \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--without-ensurepip \
&& make -j "$(nproc)" \
&& make install \
&& ldconfig \
\
&& find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' + \
&& rm -rf /usr/src/python \
\
&& python3 --version
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python3-config python-config
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 19.0.3
RUN set -ex; \
\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py
RUN pip install pandas matplotlib seaborn numpy dill
# now for InterSystems IRIS
USER irisowner
ENV SRC_DIR=/home/irisowner
COPY --chown=irisowner ./isc/ $SRC_DIR/isc
COPY --chown=irisowner ./rtn/ $SRC_DIR/rtn
COPY --chown=irisowner iscpython.so $ISC_PACKAGE_INSTALLDIR/bin/
RUN iris start $ISC_PACKAGE_INSTANCENAME && \
/bin/echo -e " do \$system.OBJ.Load(\$system.Util.GetEnviron(\"SRC_DIR\") _ \"/isc/py/util/Installer.cls\",\"ck\")\n" \
" set sc = ##class(isc.py.util.Installer).Setup(, 3)\n" \
" if 'sc write !,\$System.Status.GetErrorText(sc),! do \$system.Process.Terminate(, 1)\n" \
" zn \"%SYS\"" \
" set sc = ##class(Security.Users).UnExpireUserPasswords(\"*\")\n" \
" if 'sc write !,\$System.Status.GetErrorText(sc),! do \$system.Process.Terminate(, 1)\n" \
" do ##class(Security.Users).AddRoles(\"Admin\", \"%ALL\")\n" \
" do INT^JRNSTOP" \
" kill ^%SYS(\"JOURNAL\")" \
" kill ^SYS(\"NODE\")" \
" halt" \
| iris session $ISC_PACKAGE_INSTANCENAME && \
iris stop $ISC_PACKAGE_INSTANCENAME quietly \
&& rm -f $ISC_PACKAGE_INSTALLDIR/mgr/journal.log \
&& rm -f $ISC_PACKAGE_INSTALLDIR/mgr/IRIS.WIJ \
&& rm -f $ISC_PACKAGE_INSTALLDIR/mgr/iris.ids \
&& rm -f $ISC_PACKAGE_INSTALLDIR/mgr/alerts.log \
&& rm -f $ISC_PACKAGE_INSTALLDIR/mgr/journal/* \
&& rm -f $ISC_PACKAGE_INSTALLDIR/mgr/messages.log \
&& rm -rf $SRC_DIR/isc $SRC_DIR/rtn \
&& touch $ISC_PACKAGE_INSTALLDIR/mgr/messages.log
HEALTHCHECK --interval=5s CMD /irisHealth.sh || exit 1