$ cat Singularity Bootstrap: docker From: fedora:latest %help This is a container for ... project See https://gitlab.com/... Email ... %labels Homepage https://gitlab.com/... Author ... Maintainer ... Version 0.1 %files /home/where/is/your/project /projectX %post dnf -y install python2-biopython python2-numpy python2-tabulate python2-scikit-learn pymol mono-core python2-unittest2 python2-svgwrite python2-requests chown -R 1000:1000 /projectX # probably not important %test cd /projectX python -m unittest discover %environment export LC_ALL=C %runscript exec /projectX/worker.shMajority of above is not needed: e.g. "%help" have completely free form, keys in "%labels" does not seem to be codified, "%test" which is ran as a last step of a build process is also optional. To build it:
$ sudo singularity build --writable projectXy.simg Singularity # *.simg is a native format of singularity-2.4.6 $ sudo singularity build --writable projectX.img projectX.simg # where the project is supposed to run, there is 2.3.2 which needs older *.img, so convert *.simg into itMine original idea was to have the project in writable container (so the option "--writable" above), but that would require me to run it as root again (or I'm missing something), so I have ended up with the solution of running the container in read-only mode and mounting mine project into it to have a read-write-able directory where I can generate the data:
$ echo "cd /projectX; ./worker.sh" \ | singularity exec --bind projectX/:/projectX projectX.img bashSo far it looks like it just works.