Skip to content

Commit 17707f9

Browse files
committed
Added a singularity definition file for building a sandbox image containing provdb-python and jupyter
1 parent 19965f6 commit 17707f9

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Bootstrap: docker
2+
From: ubuntu:18.04
3+
Stage: build
4+
5+
%files
6+
provdb_python_spack_env /opt/spack-environment/spack.yaml
7+
jupyter_example.ipynb /jupyter/
8+
%post
9+
apt-get update && apt-get install -y build-essential wget && apt-get clean && rm -rf /var/lib/apt/lists/*
10+
11+
export CONDA_DIR=/opt/conda
12+
export PATH=/opt/conda/bin:$PATH
13+
14+
mkdir /Downloads && cd /Downloads
15+
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && /bin/bash ./miniconda.sh -b -p /opt/conda && rm miniconda.sh
16+
17+
apt-get update && apt-get install -y git
18+
git clone https://github.com/CODARcode/PerformanceAnalysis.git && rm -rf PerformanceAnalysis/spack/repo/chimbuko/packages/binutils
19+
git clone https://github.com/mochi-hpc/mochi-spack-packages.git
20+
cd /
21+
git clone https://github.com/spack/spack.git
22+
cd /Downloads
23+
. /spack/share/spack/setup-env.sh && spack repo add PerformanceAnalysis/spack/repo/chimbuko && spack repo add mochi-spack-packages
24+
cd /opt/spack-environment
25+
. /spack/share/spack/setup-env.sh && spack env activate . && spack install --fail-fast && spack gc -y
26+
27+
apt-get update && apt-get install -y file && find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
28+
xargs file -i | \
29+
grep 'charset=binary' | \
30+
grep 'x-executable\|x-archive\|x-sharedlib' | \
31+
awk -F: '{print $1}' | xargs strip -s
32+
33+
cd /opt/spack-environment && \
34+
. /spack/share/spack/setup-env.sh && spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
35+
36+
apt-get purge -y git && apt-get autoremove && rm -rf /var/lib/apt/lists/*
37+
rm -rf /Downloads && rm -rf /spack && rm -rf ~/.spack
38+
39+
pip3 install jupyter
40+
cd /jupyter && echo '#!/bin/bash\njupyter notebook --no-browser --port=$1 --allow-root --ip=0.0.0.0' > run_notebook.sh && chmod u+x run_notebook.sh
41+
42+
echo 'export CONDA_DIR=/opt/conda' >> $SINGULARITY_ENVIRONMENT
43+
echo 'export SPACK_ENV=/opt/spack-environment' >> $SINGULARITY_ENVIRONMENT
44+
echo 'export CMAKE_PREFIX_PATH=/opt/view:/opt/conda' >> $SINGULARITY_ENVIRONMENT
45+
echo 'export MANPATH=/opt/view/share/man:/opt/conda/share/man:/opt/conda/man:/opt/view/man:.:' >> $SINGULARITY_ENVIRONMENT
46+
echo 'export PATH=/opt/view/bin:/opt/conda/bin:/spack/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' >> $SINGULARITY_ENVIRONMENT
47+
echo 'export PKG_CONFIG_PATH=/opt/view/share/pkgconfig:/opt/view/lib/pkgconfig:/opt/conda/lib/pkgconfig:/opt/view/lib64/pkgconfig' >> $SINGULARITY_ENVIRONMENT
48+
echo 'export PYTHONPATH=/opt/view/lib/python3.10/site-packages:/opt/software/linux-ubuntu18.04-ivybridge/gcc-7.5.0/py-mochi-sonata-0.1.2-rvz76gls7gmiewupecqigb5kghjcubgl/lib/python3.10/site-packages' >> $SINGULARITY_ENVIRONMENT
49+
50+
chmod -R a+rwX /opt /jupyter
51+
find / -type d -not -path '/proc/*' -exec chmod -f 777 {} \;

0 commit comments

Comments
 (0)