|
| 1 | +FROM alpine:latest |
| 2 | +MAINTAINER Feng Zheng |
| 3 | + |
| 4 | +# installs Python 3 and pip |
| 5 | +RUN apk add --no-cache python3 && \ |
| 6 | + if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \ |
| 7 | + \ |
| 8 | + python3 -m ensurepip && \ |
| 9 | + rm -r /usr/lib/python*/ensurepip && \ |
| 10 | + pip3 install --no-cache --upgrade pip setuptools wheel && \ |
| 11 | + if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi |
| 12 | + |
| 13 | +# installs data science packages |
| 14 | +RUN apk add --no-cache \ |
| 15 | + --virtual=.build-dependencies \ |
| 16 | + g++ gcc gfortran file binutils \ |
| 17 | + musl-dev python3-dev cython \ |
| 18 | + openblas-dev postgresql-dev && \ |
| 19 | + apk add libstdc++ openblas openssh-client openssl postgresql-libs && \ |
| 20 | + \ |
| 21 | + ln -s locale.h /usr/include/xlocale.h && \ |
| 22 | + \ |
| 23 | + pip install --upgrade cython && \ |
| 24 | + pip install psycopg2 && \ |
| 25 | + pip install numpy && \ |
| 26 | + pip install pandas && \ |
| 27 | + pip install scipy && \ |
| 28 | + pip install scikit-learn && \ |
| 29 | + \ |
| 30 | + rm -r /root/.cache && \ |
| 31 | + find /usr/lib/python3.*/ -name 'tests' -exec rm -r '{}' + && \ |
| 32 | + find /usr/lib/python3.*/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \; && \ |
| 33 | + \ |
| 34 | + rm /usr/include/xlocale.h && \ |
| 35 | + \ |
| 36 | + apk del .build-dependencies |
| 37 | + |
| 38 | +# Add pycddlib and cvxopt with GLPK |
| 39 | +RUN cd /tmp && \ |
| 40 | + apk add --no-cache \ |
| 41 | + --virtual=.build-dependencies \ |
| 42 | + gcc make file binutils \ |
| 43 | + musl-dev python3-dev cython gmp-dev suitesparse-dev openblas-dev && \ |
| 44 | + apk add gmp suitesparse && \ |
| 45 | + \ |
| 46 | + pip install pycddlib && \ |
| 47 | + \ |
| 48 | + wget "ftp://ftp.gnu.org/gnu/glpk/glpk-4.65.tar.gz" && \ |
| 49 | + tar xzf "glpk-4.65.tar.gz" && \ |
| 50 | + cd "glpk-4.65" && \ |
| 51 | + ./configure --disable-static && \ |
| 52 | + make -j4 && \ |
| 53 | + make install-strip && \ |
| 54 | + CVXOPT_BLAS_LIB=openblas CVXOPT_LAPACK_LIB=openblas CVXOPT_BUILD_GLPK=1 pip install --global-option=build_ext --global-option="-I/usr/include/suitesparse" cvxopt && \ |
| 55 | + \ |
| 56 | + rm -r /root/.cache && \ |
| 57 | + find /usr/lib/python3.*/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \; && \ |
| 58 | + \ |
| 59 | + apk del .build-dependencies && \ |
| 60 | + rm -rf /tmp/* |
0 commit comments