diff --git a/.gitignore b/.gitignore index 114d4a94d8..c9c02da2d3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ _build # Test artifacts mcmc.sqlite + +# Docker development +notebooks/ diff --git a/scripts/Dockerfile b/scripts/Dockerfile new file mode 100644 index 0000000000..df40aaf258 --- /dev/null +++ b/scripts/Dockerfile @@ -0,0 +1,10 @@ +FROM continuumio/miniconda3 + +MAINTAINER Austin Rochford + +USER $NB_USER + +RUN wget -O /tmp/create_testenv.sh https://raw.githubusercontent.com/pymc-devs/pymc3/master/scripts/create_testenv.sh +RUN sh /tmp/create_testenv.sh --global + +ENV PYTHONPATH $PYTHONPATH:$HOME/pymc3 diff --git a/scripts/create_testenv.sh b/scripts/create_testenv.sh index 29c5e7f568..b0620288f5 100755 --- a/scripts/create_testenv.sh +++ b/scripts/create_testenv.sh @@ -2,17 +2,31 @@ set -e # fail on first error +while test $# -gt 0 +do + case "$1" in + --global) + GLOBAL=1 + shift + ;; + --no-setup) + NO_SETUP=1 + shift + ;; + esac +done + PYTHON_VERSION=${PYTHON_VERSION:-3.5} # if no python specified, use 3.5 -if [[ "$*" != *--global* ]] +if [ -z ${GLOBAL} ] then - conda create -n testenv --yes pip python=${PYTHON_VERSION} - source activate testenv + conda create -n testenv --yes pip python=${PYTHON_VERSION} + source activate testenv fi conda install --yes pyqt=4.11.4 jupyter pyzmq numpy scipy nose matplotlib pandas Cython patsy statsmodels joblib coverage if [ ${PYTHON_VERSION} == "2.7" ]; then - conda install --yes mock enum34; + conda install --yes mock enum34; fi pip install tqdm @@ -20,4 +34,7 @@ pip install --no-deps numdifftools pip install git+https://github.com/Theano/Theano.git pip install git+https://github.com/mahmoudimus/nose-timer.git -python setup.py build_ext --inplace +if [ -z ${NO_SETUP} ] +then + python setup.py build_ext --inplace +fi diff --git a/scripts/start_container.sh b/scripts/start_container.sh new file mode 100644 index 0000000000..e6b53e0b48 --- /dev/null +++ b/scripts/start_container.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +PORT=${PORT:-8888} +SRC_DIR=${SRC_DIR:-`pwd`} +NOTEBOOK_DIR=${NOTEBOOK_DIR:-$SRC_DIR/notebooks} + +docker build -t pymc3 $SRC_DIR/scripts +docker run -d \ + -p $PORT:8888 \ + -v $SRC_DIR:/home/jovyan/pymc3 \ + -v $NOTEBOOK_DIR:/home/jovyan/work/ \ + --name pymc3 pymc3