-
Notifications
You must be signed in to change notification settings - Fork 1
/
higgsPheno.def
93 lines (76 loc) · 2.79 KB
/
higgsPheno.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
####
# to build me
# sudo singularity build higgsPheno.sif higgsPheno.def
####
# to run me do
# singularity run --containall --bind /my/out/dir/ higgsPheno.sif
# the "--containall" flag prevents interactions with your system
# the "--bind /my/out/dir/" mounts a directory in your system
# this allows scripts in that directory to be accessed from the image
# and results from the image to persist in the directory
# It also allows the run script to call .bashrc
BootStrap: docker
From: ubuntu:18.04
# commands on the host system
# try to avoid doing stuff here
%setup
# get files from the host (but we dont need any)
%files
# what is done when the container is built
%post
# make print colour #
GREEN='\033[0;32m'
NOCOLOUR='\033[0m'
# start
echo "${GREEN}~~~ install apt packages ~~~ ${NOCOLOUR}"
apt -y update
apt -y install python2.7 git wget vim-tiny nano make libgsl-dev g++
#echo "${GREEN}~~~ Give the user permission and control ~~~ ${NOCOLOUR}"
umask 000
echo "${GREEN}~~~ Getting modified packages from github ~~~ ${NOCOLOUR}"
PACKAGES=$SINGULAITY_ROOTFS/packages
git clone https://github.com/HenryDayHall/higgsPhenoPackages.git $PACKAGES
echo "${GREEN}~~~ Making the packages ~~~ ${NOCOLOUR}"
echo "${GREEN}~~~ 2HDMC ~~~ ${NOCOLOUR}"
cd $PACKAGES/2HDMC
# for some reason the lib dir is not automaticaly constructed
mkdir lib
make
echo "${GREEN}~~~ Set up a .bashrc ~~~ ${NOCOLOUR}"
BASHRC=/home/.bashrc
touch $BASHRC
# will be called in run
echo "${GREEN}~~~ Create sylinks for programs ~~~ ${NOCOLOUR}"
ln -s $(which vim-tiny) /usr/local/bin/vim
ln -s $(which python2.7) /usr/local/bin/python
# enviroment variabels instide the container
# sourced at run time not build time
%environment
export PACKAGES=/packages/
export BASHRC=/home/.bashrc
# this is executed when the contain is launched with
# singularity run higgsPheno.sif
%runscript
# make print colour #
GREEN='\033[0;32m'
NOCOLOUR='\033[0m'
echo "${GREEN}~~~ Link packages to the users home directory ~~~ ${NOCOLOUR}"
ln -s /packages/2HDMC ~/
/bin/bash --rcfile $BASHRC
# this would be executed just after build
%test
echo I havent written any tests
# metadata
%labels
Author HenryDayHall
Version v1.0
%help
to build me
> sudo singularity build higgsPheno.sif higgsPheno.def
to run me do
> singularity run --containall --bind /my/out/dir/ higgsPheno.sif
the "--containall" flag prevents interactions with your system
the "--bind /my/out/dir/" mounts a directory in your system
this allows scripts in that directory to be accessed from the image
and results from the image to persist in the directory
It also allows the run script to call .bashrc