wc_env_manager/assets/base_image/Dockerfile.template
# :Author: Jonathan Karr <karr@mssm.edu>
# :Date: 2020-01-07
# :Copyright: 2017-2020, Karr Lab
# :License: MIT
# base
FROM ubuntu
# upgrade
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Create user to run operations in containers
RUN groupadd -r -g 999 container_user \
&& useradd -m -r -u 999 -g container_user container_user
# set time zone
ARG timezone=America/New_York
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends tzdata \
&& rm -rf /var/lib/apt/lists/* \
&& ln -fs /usr/share/zoneinfo/$timezone /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata
# set locale
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# install utilities: Git, SSH
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
git \
ssh \
&& rm -rf /var/lib/apt/lists/*
# install Python
ARG python_version=3.7.6
ARG python_version_major_minor=3.7
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libbz2-dev \
libexpat1 \
libexpat1-dev \
libffi-dev \
libffi6 \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
lzma-dev \
tar \
tk-dev \
wget \
uuid-dev \
zlib1g-dev \
# libdb5.3-dev # Berkeley DB \
# libgdbm-dev # GNU dbm database \
\
&& cd /tmp \
&& wget https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz -O /tmp/Python-${python_version}.tgz \
&& tar xzf /tmp/Python-${python_version}.tgz \
&& cd /tmp/Python-${python_version} \
&& ./configure \
--prefix=/usr/local \
--enable-optimizations \
--enable-shared \
--enable-unicode=ucs4 \
--with-system-expat \
--with-system-ffi \
&& make \
# && make test \
&& make install \
&& ldconfig \
&& python${python_version_major_minor} -m ensurepip \
&& cd / \
&& rm -r /tmp/Python-${python_version}.tgz \
&& rm -r /tmp/Python-${python_version} \
\
&& apt-get remove -y \
build-essential \
ca-certificates \
libbz2-dev \
libexpat1-dev \
libffi-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
tk-dev \
wget \
uuid-dev \
zlib1g-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Java
{% if java_install -%}
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
default-jre \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# Node
{% if npm_install -%}
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/
{%- endif %}
# curl
{% if curl_install -%}
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/
{%- endif %}
# install PostgreSQL client
{% if postgresql_client_install -%}
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
gnupg \
wget \
&& ubuntu_version=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d "=" -f 2` \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ ${ubuntu_version}-pgdg main" >> /etc/apt/sources.list.d/pgdg_${ubuntu_version}.list \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
postgresql-client-10 \
\
&& apt-get remove -y \
gnupg \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# install openbabel
{% if openbabel_install -%}
ARG openbabel_version=2.4.1
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
libcairo2-dev \
libeigen3-dev \
libxml2 \
libxml2-dev \
tar \
wget \
zlib1g-dev \
\
&& cd /tmp \
&& openbabel_version_dash=$(echo $openbabel_version | sed 's/\./-/g') \
&& wget https://github.com/openbabel/openbabel/archive/openbabel-${openbabel_version_dash}.tar.gz -O /tmp/openbabel-${openbabel_version}.tar.gz \
&& tar -xvvf /tmp/openbabel-${openbabel_version}.tar.gz \
&& cd openbabel-openbabel-${openbabel_version_dash} \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make \
# && make test \
&& make install \
&& ldconfig \
&& cd / \
&& rm -r /tmp/openbabel-${openbabel_version}.tar.gz \
&& rm -r /tmp/openbabel-openbabel-${openbabel_version_dash} \
\
&& apt-get remove -y \
build-essential \
cmake \
libcairo2-dev \
libeigen3-dev \
libxml2-dev \
wget \
zlib1g-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# install ChemAxon Marvin
{% if marvin_install -%}
ARG marvin_version=Helium.2
ARG marvin_license={{ marvin_license }}
ENV CHEMAXON_LICENSE_SERVER_KEY=${marvin_license}
COPY marvin_linux_${marvin_version}.deb /tmp/
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
default-jre \
default-jdk \
\
&& cd /tmp \
&& dpkg -i marvin_linux_${marvin_version}.deb \
&& rm marvin_linux_${marvin_version}.deb \
\
&& rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME=/usr/lib/jvm/default-java \
CLASSPATH=$CLASSPATH:/opt/chemaxon/marvinsuite/lib/MarvinBeans.jar
{%- endif %}
# install cplex
{% if cplex_install -%}
ARG cplex_version=12.10.0
ARG cplex_version_major_minor_nodot=1210
COPY cplex_studio${cplex_version_major_minor_nodot}.linux-x86-64.bin /tmp/
COPY cplex.installer.properties /tmp/
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
unzip \
\
&& cd /tmp \
&& ./cplex_studio${cplex_version_major_minor_nodot}.linux-x86-64.bin \
-f /tmp/cplex.installer.properties \
\
&& python${python_version_major_minor} /opt/ibm/ILOG/CPLEX_Studio${cplex_version_major_minor_nodot}/python/setup.py install \
\
&& rm /tmp/cplex_studio${cplex_version_major_minor_nodot}.linux-x86-64.bin \
&& rm /tmp/cplex.installer.properties \
\
&& apt-get remove -y \
unzip \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# install gurobi
{% if gurobi_install -%}
ARG gurobi_version=9.0.0
ARG gurobi_license={{ gurobi_license }}
COPY install_gurobi.exp /tmp/
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
expect \
tar \
wget \
\
&& cd /tmp \
&& gurobi_version_major=$(echo $gurobi_version | cut -d "." -f 1,2) \
&& gurobi_version_nodot=$(echo $gurobi_version | sed 's/\.//g') \
&& wget http://packages.gurobi.com/${gurobi_version_major}/gurobi${gurobi_version}_linux64.tar.gz \
&& tar xvfz gurobi${gurobi_version}_linux64.tar.gz \
&& mv gurobi${gurobi_version_nodot} /opt/ \
&& /tmp/install_gurobi.exp "${gurobi_version_nodot}" "${gurobi_license}" \
&& cd /opt/gurobi${gurobi_version_nodot}/linux64 \
&& python${python_version_major_minor} setup.py install \
&& rm /tmp/gurobi${gurobi_version}_linux64.tar.gz \
&& rm /tmp/install_gurobi.exp \
\
&& apt-get remove -y \
expect \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
ARG gurobi_version_nodot=900
ENV GUROBI_HOME=/opt/gurobi${gurobi_version_nodot}/linux64 \
PATH="${PATH}:/opt/gurobi${gurobi_version_nodot}/linux64/bin" \
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/gurobi${gurobi_version_nodot}/linux64/lib"
{%- endif %}
# install mosek
{% if mosek_install -%}
ARG mosek_version=9.1.10
COPY {{ mosek_license }} /tmp/
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
tar \
wget \
\
&& cd /tmp \
&& mosek_version_major=$(echo $mosek_version | cut -d "." -f 1,1) \
&& mosek_version_major_minor=$(echo $mosek_version | cut -d "." -f 1,2) \
&& wget https://d2i6rjz61faulo.cloudfront.net/stable/${mosek_version}/mosektoolslinux64x86.tar.bz2 \
&& tar -xvvf mosektoolslinux64x86.tar.bz2 \
&& mv /tmp/mosek /opt/ \
&& mkdir ${HOME}/mosek \
&& mv /tmp/{{ mosek_license }} ${HOME}/mosek/ \
&& cd /opt/mosek/${mosek_version_major_minor}/tools/platform/linux64x86/python/3/ \
&& python${python_version_major_minor} setup.py install \
&& rm /tmp/mosektoolslinux64x86.tar.bz2 \
&& rm ${HOME}/mosek/{{ mosek_license }} \
\
&& apt-get remove -y \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="${PATH}:/opt/mosek/${mosek_version_major}/tools/platform/linux64x86/bin" \
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/mosek/${mosek_version_major}/tools/platform/linux64x86/bin"
{%- endif %}
# install xpress
{% if xpress_install -%}
ARG xpress_version=8.8.1
ARG xpress_license_server={{ xpress_license_server }}
COPY {{ xpress_license }} /tmp/
COPY xpress.egg-info /tmp/
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
tar \
wget \
\
&& cd /tmp \
&& wget https://clientarea.xpress.fico.com/downloads/${xpress_version}/xp${xpress_version}_linux_x86_64_setup.tar \
&& mkdir xp${xpress_version}_linux_x86_64_setup \
&& tar -xvvf xp${xpress_version}_linux_x86_64_setup.tar -C xp${xpress_version}_linux_x86_64_setup \
&& cd /tmp/xp${xpress_version}_linux_x86_64_setup \
&& ./install.sh -l floating-client -a /tmp/{{ xpress_license }} -d /opt/xpressmp -k yes -s ${xpress_license_server} \
&& echo "/opt/xpressmp/lib" | tee /usr/local/lib/python${python_version_major_minor}/site-packages/xpress.pth \
&& cp /tmp/xpress.egg-info /usr/local/lib/python${python_version_major_minor}/site-packages/xpress-${xpress_version}.egg-info \
&& cd /tmp \
&& rm /tmp/xp${xpress_version}_linux_x86_64_setup.tar \
&& rm -r /tmp/xp${xpress_version}_linux_x86_64_setup \
&& rm /tmp/{{ xpress_license }} \
&& rm /tmp/xpress.egg-info \
&& rm /opt/xpressmp/bin/{{ xpress_license }} \
\
&& apt-get remove -y \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
ENV XPRESSDIR=/opt/xpressmp \
PATH=$PATH:$XPRESSDIR/bin \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/x86_64-linux-gnu:$XPRESSDIR/lib \
CLASSPATH=$CLASSPATH:$XPRESSDIR/lib/xprs.jar:$XPRESSDIR/lib/xprb.jar:$XPRESSDIR/lib/xprm.jar \
XPRESS=$XPRESSDIR/bin
{%- endif %}
# COIN-OR: CBC (latest version compatible with CyLP)
{% if cbc_install -%}
ARG cbc_version=2.8.5
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
tar \
wget \
\
&& cd /tmp \
&& wget https://www.coin-or.org/download/source/Cbc/Cbc-${cbc_version}.tgz \
&& tar -xvvf Cbc-${cbc_version}.tgz \
&& cd Cbc-${cbc_version} \
&& mkdir build \
&& cd build \
&& mkdir -p /opt/coin-or/cbc \
&& ../configure -C --prefix=/opt/coin-or/cbc --enable-gnu-packages \
&& make \
# && make test \
&& make install \
&& cd ../../ \
&& rm -r Cbc-${cbc_version} \
&& rm Cbc-${cbc_version}.tgz \
\
&& pip${python_version_major_minor} install -U cython numpy scipy \
&& pip${python_version_major_minor} install -U git+https://github.com/jjhelmus/CyLP.git@py3#egg=cylp \
\
&& apt-get remove -y \
build-essential \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
ENV COIN_INSTALL_DIR=/opt/coin-or/cbc \
PATH=${PATH}:/opt/coin-or/cbc/bin \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/coin-or/cbc/lib
{%- endif %}
# COIN-OR: coinutils
{% if coin_utils_install -%}
ARG coin_utils_version=2.10.14
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
tar \
wget \
\
&& cd /tmp \
&& wget https://www.coin-or.org/download/source/CoinUtils/CoinUtils-${coin_utils_version}.tgz \
&& tar -xvvf CoinUtils-${coin_utils_version}.tgz \
&& cd CoinUtils-${coin_utils_version} \
&& mkdir build \
&& cd build \
&& mkdir -p /opt/coin-or/coinutils \
&& ../configure -C --prefix=/opt/coin-or/coinutils --enable-gnu-packages \
&& make \
# && make test \
&& make install \
&& cd /tmp \
&& rm -r CoinUtils-${coin_utils_version} \
&& rm CoinUtils-${coin_utils_version}.tgz \
\
&& apt-get remove -y \
build-essential \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
ENV PATH=${PATH}:/opt/coin-or/coinutils/bin \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/coin-or/coinutils/lib
{%- endif %}
# install qpOASES
{% if qpoases_install -%}
ARG qpoases_version=3.2.1
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
tar \
wget \
\
&& cd /tmp \
&& wget https://www.coin-or.org/download/source/qpOASES/qpOASES-${qpoases_version}.tgz \
&& tar -xvvf qpOASES-${qpoases_version}.tgz \
&& cd qpOASES-${qpoases_version} \
&& make \
# && make test \
&& mkdir -p /opt/coin-or/qpoases/lib \
&& cp bin/libqpOASES.* /opt/coin-or/qpoases/lib \
&& cp -r include/ /opt/coin-or/qpoases \
&& cd interfaces/python \
&& pip${python_version_major_minor} install cython numpy \
&& python${python_version_major_minor} setup.py install \
&& cd /tmp \
&& rm -r qpOASES-${qpoases_version} \
&& rm qpOASES-${qpoases_version}.tgz \
\
&& apt-get remove -y \
build-essential \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/coin-or/qpoases/lib
{%- endif %}
# MINOS
{% if minos_install -%}
ARG minos_version=5.6
RUN cd /tmp \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
csh \
gfortran \
git \
make \
wget \
unzip \
\
&& pip${python_version_major_minor} install numpy \
&& wget http://stanford.edu/~saunders/tmp/quadLP.zip \
&& unzip quadLP.zip \
\
&& cd /tmp/quadLP/minos56 \
&& sed -i 's/FC = gfortran/FC = gfortran -fPIC/g' Makefile.defs \
&& make clean \
&& make \
&& cd /tmp/quadLP/minos56/test \
&& make minos \
# && ./run minos t1diet \
\
&& cd /tmp/quadLP/qminos56 \
&& sed -i 's/FC = gfortran/FC = gfortran -fPIC/g' Makefile.defs \
&& make clean \
&& make \
&& cd /tmp/quadLP/qminos56/test \
&& make minos \
# && ./run minos t1diet \
\
&& cd /tmp \
&& git clone https://github.com/SBRG/solvemepy.git \
&& cd solvemepy \
&& git checkout 72db1bac4ee8a479283f54eaf1644119967d4ac0 \
&& cp /tmp/quadLP/minos56/lib/libminos.a ./ \
&& cp /tmp/quadLP/qminos56/lib/libquadminos.a ./ \
&& pip${python_version_major_minor} install . \
\
&& cd /tmp \
&& rm -r quadLP \
&& rm quadLP.zip \
&& rm -r solvemepy \
\
&& apt-get remove -y \
csh \
make \
wget \
unzip \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# SoPlex
{% if soplex_install -%}
ARG soplex_version=3.1.1
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
tar \
wget \
\
&& cd /tmp \
&& wget http://soplex.zib.de/download/release/soplex-${soplex_version}.tgz \
&& tar -xvvf soplex-${soplex_version}.tgz \
&& cd soplex-${soplex_version} \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make \
# && make test \
&& make install \
&& cd /tmp \
&& rm -r soplex-${soplex_version} \
&& rm soplex-${soplex_version}.tgz \
\
&& apt-get install -y --no-install-recommends \
libgmp-dev \
\
&& pip${python_version_major_minor} install cython \
&& cd /tmp \
&& git clone https://github.com/SBRG/soplex_cython.git \
&& cd soplex_cython \
&& wget http://soplex.zib.de/download/release/soplex-${soplex_version}.tgz \
&& pip${python_version_major_minor} install . \
&& cd /tmp \
&& rm -r soplex_cython \
\
&& apt-get remove -y \
build-essential \
cmake \
libgmp-dev \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# SUNDIALS: SUite of Nonlinear and DIfferential/ALgebraic Equation Solvers
# https://computation.llnl.gov/projects/sundials
{% if sundials_install -%}
ARG sundials_version=3.2.1
ARG scikits_odes_version="< 2.5"
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
gfortran \
libopenblas-base \
libopenblas-dev \
wget \
\
&& cd /tmp \
&& wget https://computation.llnl.gov/projects/sundials/download/sundials-${sundials_version}.tar.gz \
&& tar xzf sundials-${sundials_version}.tar.gz \
&& cd sundials-${sundials_version} \
&& mkdir build \
&& cd build \
&& cmake \
-DEXAMPLES_ENABLE=OFF \
-DLAPACK_ENABLE=ON \
-DSUNDIALS_INDEX_TYPE=int32_t \
.. \
&& make \
&& make install \
\
&& cd /tmp \
&& rm sundials-${sundials_version}.tar.gz \
&& rm -r sundials-${sundials_version} \
\
&& pip${python_version_major_minor} install "scikits.odes ${scikits_odes_version}" \
\
&& apt-get remove -y \
build-essential \
cmake \
libopenblas-dev \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# kallisto
{% if kallisto_install -%}
ARG kallisto_version=0.46.1
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
tar \
wget \
\
&& cd /tmp \
&& wget https://github.com/pachterlab/kallisto/releases/download/v${kallisto_version}/kallisto_linux-v${kallisto_version}.tar.gz \
&& tar -xvvf kallisto_linux-v${kallisto_version}.tar.gz \
&& cp kallisto/kallisto /usr/local/bin \
&& rm -rf kallisto \
&& rm -rf kallisto_linux-v${kallisto_version}.tar.gz \
\
&& apt-get remove -y \
wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# GraphViz
{% if graphviz_install -%}
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
graphviz \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# Docker
{% if docker_install -%}
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable" \
\
&& apt-get update -y \
&& apt-get install -y --no-install-recommends docker-ce \
&& rm -rf /var/lib/apt/lists/*
{%- endif %}
# CircleCI local build agent
{% if circleci_install -%}
RUN curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci \
&& chmod +x /usr/local/bin/circleci
{%- endif %}
# Install Python packages
COPY requirements.txt /tmp/
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
build-essential \
default-libmysqlclient-dev \
enchant \
graphviz \
pandoc \
swig \
\
&& pip${python_version_major_minor} install -U pip setuptools \
&& pip${python_version_major_minor} install -U \
cython \
ipython \
pypandoc \
git+https://github.com/KarrLab/sphinxcontrib-googleanalytics.git#egg=sphinxcontrib_googleanalytics \
&& pip${python_version_major_minor} install -r /tmp/requirements.txt \
&& rm tmp/requirements.txt \
\
&& apt-get remove -y \
build-essential \
swig \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Install NCBI taxonomy database and ETE3 package
RUN pip${python_version_major_minor} install ete3 \
&& python${python_version_major_minor} -c "import ete3; ete3.NCBITaxa().get_descendant_taxa('Homo');" \
&& rm /taxdump.tar.gz
# Save image tag to file so it is accessible from within containers
ARG image_tag={{ image_tag }}
RUN echo ${image_tag} > /etc/docker-image-tag
# install debugging utilities
# RUN apt-get update -y \
# && apt-get install -y --no-install-recommends \
# nano \
# postgresql \
# snapd \
# && snap install pycharm-community --classic \
# && rm -rf /var/lib/apt/lists/*
# cleanup
# RUN apt-get remove -y \
# build-essential \
# cmake
# final command
WORKDIR /root
CMD bash