-
Notifications
You must be signed in to change notification settings - Fork 9
Deploy
Deploying your workflow on the command line is as simple as using the Singularity software. In one line, we can interact with an image directly from Singularity Hub:
singularity shell shub://vsoch/hello-world
singularity run shub://vsoch/hello-world
singularity pull shub://vsoch/hello-world
singularity exec shub://vsoch/hello-world ls /
As of Singularity 2.4, you can also use a Singularity Hub image as your Build base. This would be the header of your Singularity Recipe:
From: vsoch/hello-world
Bootstrap: shub
and then given your Singularity
Recipe file (above), you would build as follows:
sudo singularity build container.simg Singularity
Remember that a single Github repository is called a "Collection," and is associated with multiple container builds, and there can be more than one build per commit if more than one Singularity Recipe are present with different extensions, each indicating a tag:
Singularity <-- vsoch/hello-world:latest
Singularity.gpu <-- vsoch/hello-world:gpu
By default, we build from the master
branch when you first connect your repository, and if you want to add another branch to build, you can do this in your collection view:
Collection --> Settings --> Edit Branches
You can then turn on (and off) branches to build. This is also helpful if you want to disable a branch for building, while testing, or something like that:
Branches are a useful way for allowing automated building without having building happen for every single commit. If you have your production branch enabled for building, it will only build final images when you commit to it.
Let's look at a few examples for different ways we can pull images. The first generic pull will retrieve the container with the most recent modified date, across the collection:
singularity pull shub://vsoch/hello-world
singularity pull shub://doc.fish/vsoch/hello-world
Progress |===================================| 100.0%
Done. Container is at: ./vsoch-hello-world-master.simg
Notice that even though branch isn't relevant for the uri, it's represented and known. If I want to retrieve the last modified (most recent) version of a specific tag:
singularity pull shub://vsoch/singularity-images:apps
Progress |===================================| 100.0%
You can also pull a particular commit or image hash, if you know it:
singularity pull shub://vsoch/singularity-images:apps@9dccc60594c691c861b37d458d3e284b2f6923ea
Progress |===================================| 100.0%
Note from @vsoch - currently developing this API endpoint and there are still a few kinks
By default, your container will be named with the format <username>-<container>-<branch>.img
. The file is stored compressed, and decompressed when you pull it. If you anticipate serving multiple versions of your image, you might want a custom name. Singularity Hub supports naming images by hash, commit, or a custom name.
To name your image by it's md5sum content hash, you can do the following:
singularity pull --hash shub://vsoch/hello-world
Progress |===================================| 100.0%
Done. Container is at: ./0a25c3e72619acd51e9ebe3753c46ec3.img
Is it really the hash?
md5sum 0a25c3e72619acd51e9ebe3753c46ec3.img
0a25c3e72619acd51e9ebe3753c46ec3 0a25c3e72619acd51e9ebe3753c46ec3.img
You can also name by the Github commit, which is nice to go back and find it again.
singularity pull --commit shub://vsoch/hello-world
Progress |===================================| 100.0%
Done. Container is at: ./e279432e6d3962777bb7b5e8d54f30f4347d867e.img
Finally, you just might want to name it something entirely different. You can do that with --name
:
singularity pull --name meatballs.img shub://vsoch/hello-world
Progress |===================================| 100.0%
Done. Container is at: ./meatballs.img
Need help? submit an issue and let us know!