-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: build ascent docker example (#1347)
* add venv to ubuntu base * docs fix * add simplified docker example for ascent + jupyter (still wip) * resolve confusion from stray file * docker recipe adjustments
- Loading branch information
Showing
7 changed files
with
204 additions
and
161 deletions.
There are no files selected for viewing
156 changes: 0 additions & 156 deletions
156
install/examples/ascent/tutorial/ascent_intro/cpp/ascent_tutorial_cpp_utils.hpp
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
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 |
---|---|---|
@@ -0,0 +1,142 @@ | ||
# Copyright (c) Lawrence Livermore National Security, LLC and other Ascent | ||
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
# other details. No copyright assignment is required to contribute to Ascent. | ||
|
||
################################################# | ||
# all in one build of ascent container w/ jupyter | ||
################################################# | ||
|
||
FROM ubuntu:22.04 | ||
|
||
##################### | ||
# base deps | ||
##################### | ||
# add sudo to base ubuntu container | ||
# so we can install additional packages as | ||
# non-root, but admin default user on azure pipelines | ||
RUN apt-get update && apt-get -y install sudo | ||
# tzdata install wants to ask questions, so handled as sep case | ||
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata | ||
# install std packages | ||
RUN apt-get update && apt-get -y install \ | ||
binutils \ | ||
cmake \ | ||
gcc \ | ||
g++ \ | ||
gfortran \ | ||
python3 \ | ||
python3-dev \ | ||
python-is-python3 \ | ||
python3.10-venv \ | ||
clang \ | ||
llvm \ | ||
perl \ | ||
git \ | ||
git-lfs \ | ||
curl \ | ||
wget \ | ||
tar \ | ||
unzip \ | ||
file \ | ||
build-essential \ | ||
libncurses-dev \ | ||
libssl-dev \ | ||
libblas-dev \ | ||
liblapack-dev \ | ||
liblapacke-dev \ | ||
zlib1g-dev \ | ||
libgdbm-dev \ | ||
libreadline-dev \ | ||
libsqlite3-dev \ | ||
libbz2-dev \ | ||
mpich \ | ||
libmpich-dev \ | ||
openssh-server \ | ||
vim | ||
|
||
# nodejs is needed by jupyterlab for widgets | ||
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - | ||
RUN apt-get install -y nodejs | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
##################### | ||
# ascent build | ||
##################### | ||
|
||
# obtain a copy of ascent source from host env and extract | ||
COPY ascent.docker.src.tar.gz / | ||
RUN tar -xzf ascent.docker.src.tar.gz | ||
|
||
# change perms of source scripts | ||
RUN chmod -R a+rwX /ascent/ | ||
RUN chmod +x /ascent/scripts/build_ascent/build_ascent.sh | ||
|
||
# copy docker specific build script in | ||
COPY docker_build_ascent.sh / | ||
RUN ./docker_build_ascent.sh | ||
|
||
# ascent is installed at /install/ascent-checkout, symlink to /ascent/install | ||
RUN ln -s /install/ascent-checkout /ascent/install | ||
# symlink proxies for easy access next to jupyter notebooks | ||
RUN ln -s /ascent/install/examples/ascent/proxies/ /ascent/install/examples/ascent/tutorial/ascent_intro/notebooks/ | ||
# symlink notebooks to shorter root path | ||
RUN ln -s /ascent/install/examples/ascent/tutorial/ascent_intro/notebooks/ /tutorial_notebooks | ||
|
||
# change perms of build results | ||
RUN chmod a+rwX /*.sh | ||
RUN chmod -R a+rwX /install/ | ||
# setup perms for tutorial cleanup scripts | ||
RUN chmod 777 /ascent/install/examples/ascent/tutorial/ascent_intro/*/cleanup.sh | ||
|
||
# add env setup for login | ||
RUN cp /ascent_docker_setup_env.sh /etc/profile.d/ascent_docker_setup_env.sh | ||
|
||
# force the use of a login shell | ||
RUN /bin/echo -e '#!/bin/bash -l\n' \ | ||
'exec "$@"\n' \ | ||
> /etc/entrypoint.sh && \ | ||
chmod a+x /etc/entrypoint.sh | ||
|
||
# set main | ||
ENTRYPOINT ["/etc/entrypoint.sh"] | ||
|
||
##################### | ||
# jupyter lab setup | ||
##################### | ||
|
||
# add our `user` with password `docker` | ||
RUN useradd -ms /bin/bash -G sudo user && echo "user:docker" | chpasswd | ||
# allow sudo w/o password | ||
RUN echo "user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \ | ||
chmod 0440 /etc/sudoers.d/user | ||
|
||
# run the rest as `user` | ||
USER user | ||
WORKDIR /home/user | ||
|
||
# setup ssh keys for passwordless ssh to localhost | ||
RUN mkdir -p ~/.ssh | ||
RUN ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N "" | ||
RUN cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys | ||
RUN chmod 0600 ~/.ssh/authorized_keys | ||
|
||
# setup jupyter password, the password is: | ||
# learn | ||
RUN mkdir /home/user/.jupyter/ | ||
RUN echo "c.NotebookApp.password = 'sha1:9777986fd066:283f673e1a311e2d5ef58c174eaebf3e1cb536dd'" > /home/user/.jupyter/jupyter_notebook_config.py | ||
|
||
# set bash as default jupyter shell | ||
RUN echo "c.NotebookApp.terminado_settings = { 'shell_command': ['/bin/bash'] }" >> /home/user/.jupyter/jupyter_notebook_config.py | ||
|
||
# gen script that allows us to easily run jupyter lab | ||
RUN cp /ascent_docker_setup_env.sh /home/user/ascent_docker_run_jupyterlab.sh | ||
RUN echo "jupyter lab --ip=\"0.0.0.0\" --no-browser" >> /home/user/ascent_docker_run_jupyterlab.sh | ||
|
||
# make sure helpers are executable | ||
RUN sudo chmod 777 /home/user/ascent_docker_run_jupyterlab.sh | ||
|
||
# open port 8888, for use by jupyter notebook http server | ||
EXPOSE 8888 | ||
|
||
# default setup -- launch jupyter lab | ||
CMD sudo service ssh start && cd /tutorial_notebooks/ && /home/user/ascent_docker_run_jupyterlab.sh |
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,15 @@ | ||
#!/bin/bash | ||
# Copyright (c) Lawrence Livermore National Security, LLC and other Ascent | ||
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
# other details. No copyright assignment is required to contribute to Ascent. | ||
|
||
export REPO_NAME="ascent" | ||
export TAG_ARCH=`uname -m` | ||
export TAG_BASE=alpinedav/ascent:ascent-ubuntu-22.04-develop-${TAG_ARCH} | ||
|
||
date | ||
|
||
python3 ../../../../scripts/docker_build_and_tag.py ${REPO_NAME} ${TAG_ARCH} ${TAG_BASE} | ||
|
||
date | ||
|
38 changes: 38 additions & 0 deletions
38
src/examples/docker/ubuntu-build-ascent/docker_build_ascent.sh
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,38 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
env enable_python=ON \ | ||
enable_mpi=ON \ | ||
enable_FORTRAN=ON \ | ||
enable_openmp=ON \ | ||
build_pyvenv=true \ | ||
/ascent/scripts/build_ascent/build_ascent.sh | ||
|
||
# install extra python modules | ||
/install/python-venv/bin/python3 -m pip install \ | ||
--trusted-host pypi.org --trusted-host files.pythonhosted.org \ | ||
bash_kernel \ | ||
jupyter \ | ||
jupyterlab \ | ||
ipykernel \ | ||
pylint \ | ||
ipywidgets \ | ||
ipympl \ | ||
matplotlib \ | ||
pyyaml \ | ||
cinemasci \ | ||
scipy \ | ||
scikit-learn \ | ||
h5py \ | ||
llnl-hatchet | ||
|
||
cd /install/ascent-checkout/share/ascent/ascent_jupyter_bridge/ && \ | ||
/install/python-venv/bin/python3 -m ipykernel install | ||
|
||
conduit_py_path=`ls -d /install/conduit-*/python-modules` | ||
ascent_py_path=`ls -d /install/ascent-*/python-modules` | ||
vtkm_lib_path=`ls -d /install/vtk-m-*/lib` | ||
echo "export PATH=/install/python-venv/bin/:$PATH" >> /ascent_docker_setup_env.sh | ||
echo "export PYTHONPATH=${conduit_py_path}:${ascent_py_path}" >> /ascent_docker_setup_env.sh | ||
echo "export LD_LIBRARY_PATH=${vtkm_lib_path}" >> /ascent_docker_setup_env.sh | ||
|