Bootstrap: docker
From: continuumio/miniconda3

%files
    gpu.yml

%environment

%post
    ENV_NAME=$(head -1 gpu.yml | cut -d' ' -f2)
    echo ". /opt/conda/etc/profile.d/conda.sh" >> $SINGULARITY_ENVIRONMENT
    echo "conda activate $ENV_NAME" >> $SINGULARITY_ENVIRONMENT

    . /opt/conda/etc/profile.d/conda.sh
    conda env create -f gpu.yml -p /opt/conda/envs/$ENV_NAME
    conda clean --all

%runscript
    exec "$@"
