-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update Dockerfile * new script * bump req. versions
- Loading branch information
Showing
7 changed files
with
128 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
FROM docker.io/debian:bullseye | ||
FROM docker.io/debian:bookworm | ||
|
||
MAINTAINER Björn Dahlgren <[email protected]> | ||
|
||
ENV LANG C.UTF-8 | ||
|
||
RUN apt-get update && \ | ||
apt-get --quiet --assume-yes install curl git g++-10 gfortran-10 libgmp-dev binutils-dev bzip2 make cmake sudo \ | ||
python3-dev python3-pip libboost-dev libgsl-dev liblapack-dev libsuitesparse-dev graphviz && \ | ||
apt-get --quiet --assume-yes install --no-install-recommends \ | ||
curl git g++ gfortran libgmp-dev binutils-dev bzip2 make cmake sudo \ | ||
python3-dev python3-venv python3-pip libboost-dev libgsl-dev liblapack-dev libsuitesparse-dev graphviz && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
RUN mkdir /tmp/sundials-5.5.0-build && \ | ||
curl -Ls https://github.com/LLNL/sundials/releases/download/v5.5.0/sundials-5.5.0.tar.gz | tar xz -C /tmp && \ | ||
FC=gfortran-10 cmake \ | ||
-S /tmp/sundials-5.5.0 \ | ||
-B /tmp/sundials-5.5.0-build \ | ||
RUN mkdir /tmp/sundials-5.8.0-build && \ | ||
curl -Ls https://github.com/LLNL/sundials/releases/download/v5.8.0/sundials-5.8.0.tar.gz | tar xz -C /tmp && \ | ||
FC=gfortran cmake \ | ||
-S /tmp/sundials-5.8.0 \ | ||
-B /tmp/sundials-5.8.0-build \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/local \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
|
@@ -25,15 +26,11 @@ RUN mkdir /tmp/sundials-5.5.0-build && \ | |
-DENABLE_KLU=ON \ | ||
-DKLU_INCLUDE_DIR=/usr/include/suitesparse \ | ||
-DKLU_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu && \ | ||
cmake --build /tmp/sundials-5.5.0-build && \ | ||
cmake --build /tmp/sundials-5.5.0-build --target install && \ | ||
rm -r /tmp/sundials-5.5.0*/ && \ | ||
python3 -m pip install --upgrade-strategy=eager --upgrade pip && \ | ||
python3 -m pip install --upgrade-strategy=eager numpy cython setuptools && \ | ||
cmake --build /tmp/sundials-5.8.0-build && \ | ||
cmake --build /tmp/sundials-5.8.0-build --target install && \ | ||
rm -r /tmp/sundials-5.8.0*/ && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
|
||
# http://computation.llnl.gov/projects/sundials/download/sundials-5.5.0.tar.gz | ||
|
||
# At this point the system should be able to pip-install the package and all of its dependencies. We'll do so | ||
# when running the image using the ``host-jupyter-using-docker.sh`` script. Installed packages are cached. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
show_help() { | ||
echo "Usage:" | ||
echo "$(basename $0) host-notebook --port 8888 --listen 127.0.0.1" | ||
echo "$(basename $0) run-tests" | ||
} | ||
set -euxo pipefail | ||
|
||
HOST_NOTEBOOK=0 | ||
RUN_TESTS=0 | ||
PORT=8000 | ||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
host-notebook) | ||
HOST_NOTEBOOK=1 | ||
shift | ||
;; | ||
--port) | ||
shift | ||
PORT=$1 | ||
shift | ||
;; | ||
--listen) | ||
shift | ||
LISTEN=$1 | ||
shift | ||
;; | ||
run-tests) | ||
RUN_TESTS=1 | ||
shift | ||
;; | ||
--help|-h) | ||
show_help | ||
exit 0 | ||
;; | ||
--) | ||
break; | ||
;; | ||
*) | ||
show_help | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if ! which podrun >/dev/null; then | ||
SOME_TEMP_DIR=$(mktemp -d) | ||
trap 'rm -rf -- "$SOME_TEMP_DIR"' EXIT | ||
( cd "$SOME_TEMP_DIR"; curl -LOs https://raw.githubusercontent.com/bjodah/dotfiles/master/per-leaf-dir/bin/podrun; chmod +x podrun ) | ||
export PATH="$SOME_TEMP_DIR:$PATH" | ||
fi | ||
|
||
SCRIPTS_DIR=$(dirname $(realpath "$BASH_SOURCE")) | ||
REPO_DIR=$(realpath "$SCRIPTS_DIR/..") | ||
ENV_DIR="$REPO_DIR/.env" | ||
PKG_NAME=${PKG_NAME:-$(basename $REPO_DIR)} | ||
|
||
mkdir -p $ENV_DIR | ||
|
||
cat <<EOF>$ENV_DIR/setup.sh | ||
if [ ! -d .env/ ]; then | ||
>&2 echo "No .env directory?" | ||
exit 1 | ||
fi | ||
if [ ! -d .env/venv ]; then | ||
python3 -m venv .env/venv | ||
fi | ||
source .env/venv/bin/activate | ||
if ! python -c "import pycvodes" 2>&1 >/dev/null; then | ||
python -m pip install --upgrade-strategy=eager --upgrade pip && \ | ||
python -m pip install --upgrade-strategy=eager numpy 'cython>=3.0.10' setuptools && \ | ||
env \ | ||
PYCVODES_NO_LAPACK=1 \ | ||
PYCVODES_NO_KLU=1 \ | ||
LDFLAGS='-Wl,--disable-new-dtags -Wl,-rpath,/usr/local/lib -L/usr/local/lib' \ | ||
python -m pip install --cache-dir .env/pypi-cache -e .[all] | ||
fi | ||
if ! python -c "import pyodesys" 2>&1 >/dev/null; then | ||
python -m pip install --cache-dir .env/pypi-cache -e .[all] | ||
#jupyter-nbextension enable --user --py widgetsnbextension | ||
fi | ||
export MPLBACKEND=Agg | ||
EOF | ||
cat <<EOF>$ENV_DIR/run-tests.sh | ||
#!/bin/bash | ||
set -e | ||
source .env/setup.sh | ||
pytest -sv -ra --pyargs $PKG_NAME | ||
EOF | ||
cat <<EOF>$ENV_DIR/host-notebook.sh | ||
#!/bin/bash | ||
set -e | ||
source .env/setup.sh | ||
jupyter notebook --no-browser --port $PORT --ip=* index.ipynb | ||
EOF | ||
if [ $RUN_TESTS = 1 ]; then | ||
podrun --cont-img-dir $SCRIPTS_DIR/environment \ | ||
--name "${PKG_NAME}_run_tests" \ | ||
-- bash $ENV_DIR/run-tests.sh | ||
fi | ||
if [ $HOST_NOTEBOOK = 1 ]; then | ||
podrun --cont-img-dir $SCRIPTS_DIR/environment \ | ||
--name "${PKG_NAME}_host_notebook_${PORT}" \ | ||
-p $LISTEN:$PORT:$PORT \ | ||
-- bash $ENV_DIR/host-notebook.sh | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters