Git Product home page Git Product logo

singularity-conda-multiple-envs's Introduction

Singularity image from Conda multi-environment script

First env CI Second env CI Third env CI

Image build and push

Singularity containerization of a Conda-based multi-environment bash script.

Requirements

Manual execution

# environments creation
./create_conda_envs.sh

# run.sh in different environments
conda activate first-env
./run.sh

conda activate second-env
./run.sh

conda activate third-env
./run.sh

Local Singularity image build

Run quay.io/singularity Docker image and access its bash with

docker run \
  --interactive --tty --rm --privileged \
  --volume $(pwd)/create_conda_envs.sh:/go/create_conda_envs.sh \
  --volume $(pwd)/environment-01.yml:/go/environment-01.yml \
  --volume $(pwd)/environment-02.yml:/go/environment-02.yml \
  --volume $(pwd)/environment-03.yml:/go/environment-03.yml \
  --volume $(pwd)/run.sh:/go/run.sh \
  --volume $(pwd)/runscript.sh:/go/runscript.sh \
  --volume $(pwd)/singularity-image.def:/go/singularity-image.def \
  --volume $(pwd)/out:/go/out \
  --entrypoint /bin/bash \
  quay.io/singularity/singularity:v3.7.2

then, from within the container's bash run

export IMAGE_FILENAME=/go/out/image.sif

# build
singularity build $IMAGE_FILENAME singularity-image.def

# inspect
ls -lah $IMAGE_FILENAME
singularity inspect $IMAGE_FILENAME
singularity inspect --deffile $IMAGE_FILENAME

# run
singularity run $IMAGE_FILENAME

Singularity image signing

Login into Sylabs.io and generate a Singularity Cloud token. Download the token file and save it to ~/.singularity/sylabs-token.

To generate a new key to sign a Singularity image in a GitHub Action, run

singularity keys newpair

and publish the public key on the Singularity Cloud.

Then update the repository secrets as follows

  • SINGULARITY_CLOUD_TOKEN: run < ~/.singularity/sylabs-token | pbcopy (on macOS) and paste the content of your clipboard as value of the secret,
  • SINGULARITY_PGP_PASSPHRASE: newly generated key's passphrase and
  • SINGULARITY_PGP_SECRET_BASE64: run < ~/.singularity/sypgp/pgp-secret | base64 | pbcopy (on macOS) and paste the content of your clipboard as value of the secret.

singularity-conda-multiple-envs's People

Contributors

horothesun avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.