Пример #1
0
def singleStageBuild(stage):
    stage += label(metadata={'MAINTAINER': 'Simeon Ehrig'})
    stage += label(metadata={'EMAIL': '*****@*****.**'})
    stage += label(metadata={'Version': str(container_version)})
    stage += environment(variables={'GOL_VERSION': str(container_version)})

    # copy example inside container
    stage += copy(src='notebook', dest='/')

    # copy and build the pnwriter library
    stage += copy(src='pngwriter', dest='/opt')
    stage += packages(ospackages=['libpng-dev'])
    cmake = CMakeBuild(prefix='/notebook/pngwriter')
    stage += shell(commands=[
        cmake.configure_step(directory='/opt/pngwriter',
                             opts=['-DBUILD_SHARED_LIBS=ON']),
        cmake.build_step(target='install'), 'rm -rf /opt/pngwriter'
    ])

    # Copy notebook examples and pngwriter lib to the host's /tmp file system to obtain a writable file system.
    stage += runscript(commands=[
        'if [ ! -d /tmp/GOL-xeus-cling-cuda ]; then \n'
        ' mkdir /tmp/GOL-xeus-cling-cuda &&'
        ' cp -r /notebook/ /tmp/GOL-xeus-cling-cuda\n fi',
        'cd /tmp/GOL-xeus-cling-cuda/notebook', 'jupyter-lab'
    ])

    print(stage.__str__())
Пример #2
0
def build(container_format='singularity', os_release='ubuntu', os_version='20.04'):
    config.set_container_format(container_format)

    image = f'{os_release}:{os_version}'

    stage0 = Stage(name='stage0')
    stage0 += baseimage(image=image, _bootstrap='docker')
    stage0 += environment(variables={
        'LC_ALL': 'en_AU.UTF-8',
        'LANGUAGE': 'en_AU.UTF-8',
    })
    stage0 += label(metadata={'maintainer': 'Luhan Cheng', 'email': '*****@*****.**'})
    stage0 += shell(commands=['rm /usr/bin/sh', 'ln -s /usr/bin/bash /usr/bin/sh', '/usr/bin/bash'])
    stage0 += packages(apt=['wget', 'git', 'software-properties-common', 'build-essential', 'locales', 'zlib1g-dev'])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += comment('Installing vglrun and TurboVNC')
    stage0 += packages(apt=['ubuntu-desktop', 'vim', 'mesa-utils', 'python3-pip', 'python3-pyqt5', 'pyqt5-dev', 'python3-tk'])
    stage0 += shell(commands=[
        'wget https://swift.rc.nectar.org.au/v1/AUTH_810/CVL-Singularity-External-Files/turbovnc_2.2.5_amd64.deb && dpkg -i turbovnc_2.2.5_amd64.deb && rm turbovnc_2.2.5_amd64.deb',
        'wget https://swift.rc.nectar.org.au/v1/AUTH_810/CVL-Singularity-External-Files/virtualgl_2.6.4_amd64.deb && dpkg -i virtualgl_2.6.4_amd64.deb && rm virtualgl_2.6.4_amd64.deb',
        'apt update',
        'apt -y upgrade'
    ])
    stage0 += shell(commands=[
        'curl -sL https://deb.nodesource.com/setup_12.x | bash -',
        'apt install -y nodejs npm'
    ])
    prefix = '/var/www'
    stage0 += shell(commands=[
        f'mkdir {prefix} && cd {prefix}',
        'git clone --branch 1.16.10-release https://github.com/gmod/jbrowse .',
        './setup.sh',
    ])
    stage0 += environment(variables={
        'PATH': f'{prefix}/bin:$PATH'
    })
    stage0 += runscript(commands=[
        f'cd {prefix}',
        'npm run start $*'
    ])

    return stage0
Пример #3
0
def build(container_format='singularity', os_release='ubuntu', os_version='20.04', cuda_version='11.0'):
    config.set_container_format(container_format)
    image = f'{os_release}:{os_version}'
    stage0 = Stage(name='stage0')
    stage0 += baseimage(image=image, _bootstrap='docker')
    stage0 += environment(variables={
        'LC_ALL': 'en_AU.UTF-8',
        'LANGUAGE': 'en_AU.UTF-8',
    })
    stage0 += label(metadata={'maintainer': 'Luhan Cheng', 'email': '*****@*****.**'})
    stage0 += shell(commands=['rm /usr/bin/sh', 'ln -s /usr/bin/bash /usr/bin/sh', '/usr/bin/bash'])

    stage0 += packages(apt=['wget', 'git', 'software-properties-common', 'build-essential', 'locales'])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += comment('Installing vglrun and TurboVNC')
    stage0 += packages(apt=['ubuntu-desktop', 'vim', 'mesa-utils', 'python3-pip', 'python3-pyqt5', 'pyqt5-dev', 'python3-tk'])
    stage0 += shell(commands=[
        'wget https://swift.rc.nectar.org.au/v1/AUTH_810/CVL-Singularity-External-Files/turbovnc_2.2.5_amd64.deb && dpkg -i turbovnc_2.2.5_amd64.deb && rm turbovnc_2.2.5_amd64.deb',
        'wget https://swift.rc.nectar.org.au/v1/AUTH_810/CVL-Singularity-External-Files/virtualgl_2.6.4_amd64.deb && dpkg -i virtualgl_2.6.4_amd64.deb && rm virtualgl_2.6.4_amd64.deb',
        'apt update',
        'apt -y upgrade'
    ])

    stage0 += conda(
        eula=True,
        packages=['python=3.8.5', 'openjdk', 'pip'],
    )
    stage0 += environment(variables=from_prefix('/usr/local/anaconda'))
    stage0 += shell(commands=['pip install --upgrade minerl'])
    stage0 += shell(commands=[
        'wget https://launcher.mojang.com/download/Minecraft.deb && dpkg -i Minecraft.deb && rm Minecraft.deb',
    ])

    stage0 += runscript(commands=['source /usr/local/anaconda/etc/profile.d/conda.sh', '/usr/local/anaconda/bin/python3 $*'])



    return stage0
Пример #4
0
def get_stage(container):
    # generate baseimage
    hpccm.config.set_container_format(container)
    # version >3.2 is necessary for multi-stage build
    if container == 'singularity':
        hpccm.config.set_singularity_version('3.3')
    Stage0 = hpccm.Stage()
    Stage0 += baseimage(image='ubuntu:bionic')

    # copy project from outside in the container
    if container == 'singularity':
        Stage0 += copy(src='../hello_world_tool', dest='/opt/')
    else:
        # docker: cannot copy files from outsite the build context
        # so, we need to move the build context one level up
        Stage0 += copy(src='./hello_world_tool', dest='/opt/hello_world_tool')

    # install compiler tools
    Stage0 += cmake(eula=True, version='3.14.5')
    Stage0 += packages(ospackages=['g++', 'make', 'wget', 'build-essential'])

    # build and install project
    cmb = CMakeBuild()
    cm = []
    cm.append(cmb.configure_step(build_directory='/opt/build_hello_world_tool',
                                 directory='/opt/hello_world_tool/'))
    cm.append(cmb.build_step(target='install'))
    Stage0 += shell(commands=cm)

    Stage0 += shell(commands=build_openssl(name='openssl-1.1.1c',
                                            build_dir='/opt/openssl_build'))

    # script that runs when
    # - singularity uses the run parameter or the image runs directly
    # - docker uses the run parameter without arguments
    Stage0 += runscript(commands=['hello_world_tool'])

    return Stage0
Пример #5
0
def get_stage(container):
    # generate baseimage
    hpccm.config.set_container_format(container)
    # version >3.2 is necessary for multi-stage build
    if container == 'singularity':
        hpccm.config.set_singularity_version('3.3')
    Stage0 = hpccm.Stage()
    # the stages need "names" so that they can reference each other
    Stage0 += baseimage(image='ubuntu:bionic', _as='Stage0')

    # copy project from outside in the container
    if container == 'singularity':
        Stage0 += copy(src='../hello_world_tool', dest='/opt/')
    else:
        # docker: cannot copy files from outsite the build context
        # so, we need to move the build context one level up
        Stage0 += copy(src='./hello_world_tool', dest='/opt/hello_world_tool')

    # install compiler tools
    Stage0 += cmake(eula=True, version='3.14.5')
    Stage0 += packages(ospackages=['g++', 'make', 'wget', 'build-essential'])

    # build and install project
    cmb = CMakeBuild(prefix="/opt/hello_install/")
    cm = []
    cm.append(
        cmb.configure_step(build_directory='/opt/build_hello_world_tool',
                           directory='/opt/hello_world_tool/',
                           opts=['-DCMAKE_INSTALL_RPATH=/usr/local/lib/']))
    cm.append(cmb.build_step(target='install'))
    Stage0 += shell(commands=cm)

    Stage0 += shell(commands=build_openssl(name='openssl-1.1.1c',
                                           build_dir='/opt/openssl_build'))

    # add release stage
    Stage1 = hpccm.Stage()
    Stage1 += baseimage(image='ubuntu:bionic', _as='Stage1')
    Stage1 += copy(_from='Stage0',
                   src='/opt/hello_install/',
                   dest='/usr/local/')

    Stage1 += copy(_from='Stage0',
                   src='/opt/openssl_install/',
                   dest='/usr/local/')

    # the commands merge the bin, lib ect. folders of hello_install and openssl_install
    # in the /usr/local folder
    if container == "singularity":
        Stage1 += shell(commands=[
            'cp -rl /usr/local/hello_install/* /usr/local/',
            'cp -rl /usr/local/openssl_install/* /usr/local/',
            'rm -r /usr/local/hello_install/',
            'rm -r /usr/local/openssl_install/'
        ])

    # script that runs when
    # - singularity uses the run parameter or the image runs directly
    # - docker uses the run parameter without arguments
    Stage1 += runscript(commands=['hello_world_tool'])

    return [Stage0, Stage1]
    "cd /usr/local/cuda/lib64/", "ln -s libcufft.so.10.1.168 libcufft.so.8.0"
])

# Relion
Stage1 += copy(_from=Stage0.name,
               src='/opt/relion-3.0.7/bin/',
               dest='/opt/relion-3.0.7/bin/')
Stage1 += copy(_from=Stage0.name,
               src='/opt/relion-3.0.7/lib/',
               dest='/opt/relion-3.0.7/lib/')

# MotionCor2
Stage1 += copy(_from=Stage0.name,
               src='/opt/MotionCor2_1.2.6',
               dest='/opt/MotionCor2_1.2.6')

# Gctf
Stage1 += copy(_from=Stage0.name,
               src='/opt/Gctf_v1.06/bin',
               dest='/opt/Gctf_v1.06/bin')

# ctffind
Stage1 += copy(_from=Stage0.name,
               src='/opt/ctffind-4.1.13/bin',
               dest='/opt/ctffind-4.1.13/bin')

# ResMap
Stage1 += copy(_from=Stage0.name, src='/opt/resmap', dest='/opt/resmap')

Stage1 += runscript(commands=["$*"])
Пример #7
0
def build(container_format='singularity',
          flavour="devel",
          os_release='ubuntu',
          os_version='20.04',
          cuda_version='11.3.0',
          python_version='3.8',
          anaconda_version='4.9.2',
          alphafold_path="/opt/alphafold",
          version='2.1.2'):

    config.set_container_format(container_format)
    image = f'nvcr.io/nvidia/cuda:{cuda_version}-{flavour}-{os_release}{os_version}'

    stage0 = Stage(name='stage0')
    stage0 += baseimage(image=image, _bootstrap='docker')
    stage0 += environment(variables={
        'LC_ALL': 'en_AU.UTF-8',
        'LANGUAGE': 'en_AU.UTF-8',
    })
    stage0 += label(metadata={
        'maintainer': 'Luhan Cheng',
        'email': '*****@*****.**'
    })
    stage0 += shell(commands=[
        'rm -f /bin/sh && ln -s /bin/bash /bin/sh',
        'rm -f /usr/bin/sh && ln -s /usr/bin/bash /usr/bin/sh',
        '/bin/bash',
    ])

    stage0 += environment(variables=from_prefix('/usr/local/cuda'))
    stage0 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales', 'zlib1g-dev', 'vim'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += conda(eula=True,
                    packages=[
                        f'python={python_version}', "openmm==7.5.1",
                        "cudnn==8.2.1.32", "cudatoolkit==11.0.3",
                        "pdbfixer==1.7", "hmmer==3.3.2", "hhsuite==3.3.0",
                        "kalign2==2.04"
                    ],
                    channels=['conda-forge', 'bioconda'],
                    version=anaconda_version)
    stage0 += environment(variables=from_prefix('/usr/local/anaconda'))
    stage0 += shell(commands=['conda activate base'])

    stage0 += shell(commands=[
        f"mkdir -p {alphafold_path}",
        f'git clone -b v{version} https://github.com/deepmind/alphafold.git {alphafold_path}'
    ])
    stage0 += environment(variables={"ALPHAFOLD_PATH": f"{alphafold_path}"})

    stage0 += shell(commands=[
        f'wget -q -P {alphafold_path}/alphafold/common/ https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt'
    ])
    stage0 += pip(packages=[
        "absl-py==0.13.0", "biopython==1.79", "chex==0.0.7", "dm-haiku==0.0.4",
        "dm-tree==0.1.6", "immutabledict==2.0.0", "ml-collections==0.1.0",
        "numpy==1.19.5", "scipy==1.7.0", "tensorflow==2.5.0", "pandas==1.3.4",
        "tensorflow-cpu==2.5.0"
    ],
                  pip='pip3')
    stage0 += pip(packages=[
        "jax",
        "jaxlib==0.1.69+cuda111 -f https://storage.googleapis.com/jax-releases/jax_releases.html"
    ],
                  upgrade=True,
                  pip='pip3')
    stage0 += pip(packages=[f'-r {alphafold_path}/requirements.txt'],
                  pip='pip3')
    stage0 += shell(commands=[
        f'cd /usr/local/anaconda/lib/python{python_version}/site-packages/ && patch -p0 < {alphafold_path}/docker/openmm.patch'
    ])
    stage0 += shell(commands=[
        f'cd {alphafold_path}',
        'wget https://raw.githubusercontent.com/0luhancheng0/hpccm-containers/main/src/hpccm_containers/alphafold/run_alphafold.sh && chmod a+x run_alphafold.sh'
    ])
    stage0 += runscript(commands=[
        'source /usr/local/anaconda/etc/profile.d/conda.sh',
        f"cd {alphafold_path}", f'{alphafold_path}/run_alphafold.sh $@'
    ])

    return stage0
Пример #8
0
def build(container_format='singularity',
          image='ubuntu:20.04',
          version='3.8.7',
          gnu_version='10',
          mkl_version='2020.0-088',
          numpy_version='1.20.0rc2'):
    config.set_container_format(container_format)
    stage0 = Stage(name='stage0')
    stage0 += baseimage(image=image, _bootstrap='docker')
    stage0 += label(metadata={
        'maintainer': 'Luhan Cheng',
        'email': '*****@*****.**'
    })
    stage0 += shell(
        commands=['rm /bin/sh && ln -s /bin/bash /bin/sh', '/bin/bash'])
    stage0 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])
    stage0 += environment(variables={
        'LC_ALL': 'en_AU.UTF-8',
        'LANGUAGE': 'en_AU.UTF-8',
    })
    filename = f'Python-{version}.tar.xz'
    url = f'https://www.python.org/ftp/python/{version}/{filename}'
    stage0 += packages(apt=[
        'wget', 'xz-utils', 'build-essential', 'software-properties-common',
        'libsqlite3-dev', 'libssl-dev', 'libbz2-dev', 'libgdbm-compat-dev',
        'libssl-dev', 'liblzma-dev', 'tk-dev', 'uuid-dev', 'libreadline-dev',
        'zlib1g-dev', 'python-dev', 'libncurses*-dev', 'libgdbm-dev',
        'libsqlite3-dev', 'libffi-dev', 'git'
    ])
    compiler = gnu(version=gnu_version)
    stage0 += compiler
    # stage0 += shell(commands=[
    #     'export LDFLAGS="-rpath /usr/local/python/bin $LDFLAGS"'
    # ])
    stage0 += generic_autotools(
        url=url,
        directory=f'Python-{version}',
        prefix='/usr/local/python',
        with_computed_goto=True,
        with_threads=True,
        enable_shared=True,
        enable_profiling=True,
        enable_optimizations=True,
        with_pydebug=True,
        enable_ipv6=True,
        toolchain=compiler.toolchain,
        # build_environment={
        #     'CPPFLAGS': '"-Wl,-rpath=/usr/local/python/lib $CPPFLAGS"'
        # }
    )
    stage0 += packages(apt=['patchelf'])
    stage0 += shell(commands=[
        # 'snap install patchelf --edge --classic',
        'patchelf --set-rpath /usr/local/python/lib /usr/local/python/bin/python3',
    ])
    stage0 += environment(variables=from_prefix('/usr/local/python'))
    stage0 += mkl(version=mkl_version, eula=True)
    stage0 += shell(commands=['source /opt/intel/mkl/bin/mklvars.sh intel64'])
    stage0 += pip(
        packages=['Cython>0.29.21', 'pytest>1.15', 'Hypothesis>5.3.0'],
        pip='pip3')
    stage0 += shell(commands=[
        f'git clone --branch v{numpy_version} https://github.com/numpy/numpy.git',
        'apt remove -y python-numpy python-scipy', 'rm -rf /numpy'
    ])
    stage0 += runscript(commands=['/usr/local/python/bin/python3 $*'])

    return stage0
def main():
    parser = argparse.ArgumentParser(
        description=
        'Simple script for generating a singularity recipe for the GOL example.'
    )
    parser.add_argument(
        '--build_prefix',
        type=str,
        default='/tmp/GOL_example',
        help=
        'Define the path in which all projects will be built (default: /tmp/GOL_example).'
    )
    parser.add_argument('-v ',
                        '--version',
                        action='store_true',
                        help='print version of the container')
    args = parser.parse_args()

    if args.version:
        print(container_version)
        sys.exit(0)

    hpccm.config.set_container_format('singularity')
    hpccm.config.set_singularity_version('3.3')
    stage = hpccm.Stage()

    stage += label(metadata={'GOL_MAINTAINER': 'Simeon Ehrig'})
    stage += label(metadata={'GOL_EMAIL': '*****@*****.**'})
    stage += label(metadata={'GOL_Version': str(container_version)})

    # copy example inside container
    stage += copy(src='notebook', dest='/')
    stage += copy(src='jupyter_notebook_config.py', dest='/')

    # copy and build the pnwriter library
    stage += packages(ospackages=['libpng-dev'])
    png = []

    png_git = git()
    png.append(
        png_git.clone_step(
            repository='https://github.com/pngwriter/pngwriter.git',
            branch='dev',
            path='/opt/'))

    png_cmake = CMakeBuild(prefix='/notebook/pngwriter')
    png.append(
        png_cmake.configure_step(directory='/opt/pngwriter',
                                 opts=['-DBUILD_SHARED_LIBS=ON']))
    png.append(png_cmake.build_step(target='install'))
    png.append('rm -rf /opt/pngwriter')

    stage += shell(commands=png)

    # Copy notebook examples and pngwriter lib to the host's /tmp file system to obtain a writable file system.
    stage += runscript(commands=[
        'if [ ! -d /tmp/GOL-xeus-cling-cuda ]; then \n'
        ' mkdir /tmp/GOL-xeus-cling-cuda &&'
        ' cp -r /notebook/ /tmp/GOL-xeus-cling-cuda &&'
        ' ln -s /tmp/GOL-xeus-cling-cuda/notebook/pngwriter'
        '  /tmp/GOL-xeus-cling-cuda/notebook/GTC_presentations/simulation/ \n fi',
        'cd /tmp/GOL-xeus-cling-cuda/notebook',
        'jupyter-notebook --config=/jupyter_notebook_config.py'
    ])

    # Add the bootstrap manually because hpccm does not support .sregistry,
    recipe = stage.__str__()
    recipe = 'Bootstrap: library\nFrom: sehrig/default/xeus-cling-cuda:2.3\n\n' + recipe

    print(recipe)
Пример #10
0
def build(python_version='3.6', freesurfer_version='6.0.1'):
    stage0 = Stage()
    config.set_container_format('singularity')
    stage0 += baseimage(image='nvidia/cuda:10.0-cudnn7-runtime-ubuntu16.04',
                        _bootstrap='docker')
    stage0 += shell(
        commands=['rm /bin/sh', 'ln -s /bin/bash /bin/sh', '/bin/bash'])
    stage0 += packages(apt=[
        'build-essential', 'cmake', 'git', 'vim', 'wget', 'ca-certificates',
        'bzip2', 'libx11-6', 'libjpeg-dev', 'libpng-dev', 'bc', 'tar', 'zip',
        'gawk', 'tcsh', 'time', 'libgomp1', 'libglu1-mesa', 'libglu1-mesa-dev',
        'perl-modules'
    ])
    stage0 += comment(
        "https://github.com/Deep-MI/FastSurfer/blob/master/Docker/Dockerfile")
    stage0 += shell(commands=[
        f"wget -qO- https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/{freesurfer_version}/freesurfer-Linux-centos6_x86_64-stable-pub-v{freesurfer_version}.tar.gz | tar zxv --no-same-owner -C /opt \
        --exclude='freesurfer/trctrain' \
        --exclude='freesurfer/subjects/fsaverage_sym' \
        --exclude='freesurfer/subjects/fsaverage3' \
        --exclude='freesurfer/subjects/fsaverage4' \
        --exclude='freesurfer/subjects/fsaverage5' \
        --exclude='freesurfer/subjects/fsaverage6' \
        --exclude='freesurfer/subjects/cvs_avg35' \
        --exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
        --exclude='freesurfer/subjects/bert' \
        --exclude='freesurfer/subjects/V1_average' \
        --exclude='freesurfer/average/mult-comp-cor' \
        --exclude='freesurfer/lib/cuda' \
        --exclude='freesurfer/lib/qt'",
    ])
    stage0 += conda(
        channels=['pytorch', 'conda-forge'],
        packages=[
            f'python={python_version}', 'scipy', 'numpy', 'matplotlib', 'h5py',
            'scikit-image', 'pytorch', 'cudatoolkit=10.0',
            'pytorch=1.2.0=py3.6_cuda10.0.130_cudnn7.6.2_0',
            'torchvision=0.4.0', 'scikit-sparse', 'nibabel=2.5.1',
            'pillow=7.1.1'
        ],
        eula=True,
    )
    stage0 += generic_build(
        repository='https://github.com/Deep-MI/FastSurfer.git',
        # branch='c5894bd',
        build=['git checkout c5894bd'],
        install=['mkdir /fastsurfer && mv * /fastsurfer/'])
    stage0 += environment(
        variables={
            'OS': 'Linux',
            'FS_OVERRIDE': 0,
            'FIX_VERTEX_AREA': '',
            'SUBJECTS_DIR': '/opt/freesurfer/subjects',
            'FSF_OUTPUT_FORMAT': 'nii.gz',
            'MNI_DIR': '/opt/freesurfer/mni',
            'LOCAL_DIR': '/opt/freesurfer/local',
            'FREESURFER_HOME': '/opt/freesurfer',
            'FSFAST_HOME': '/opt/freesurfer/fsfast',
            'PERL5LIB': '/opt/freesurfer/mni/lib/perl5/5.8.5',
            'MNI_PERL4LIB': '/opt/freesurfer/mni/lib/perl5/5.8.5',
            'PYTHONNUMBUFFERED': 0,
            'PATH':
            '/fastsurfer/recon_surf:/fastsurfer:/usr/local/anaconda/bin:/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:$PATH',
            **from_prefix('/usr/local/cuda')
        })
    stage0 += runscript(commands=[
        'cd /fastsurfer', 'source /usr/local/anaconda/etc/profile.d/conda.sh',
        'source $FREESURFER_HOME/SetUpFreeSurfer.sh', "$*"
    ])
    return stage0
Пример #11
0
def main():
    parser = argparse.ArgumentParser(
        description=
        'Simple script for generating a singularity recipe for the GOL exercise.'
    )
    parser.add_argument(
        '--build_prefix',
        type=str,
        default='/tmp/GOL_example',
        help=
        'Define the path in which all projects will be built (default: /tmp/GOL_example).'
    )
    parser.add_argument('-j',
                        type=str,
                        help='number of build threads for make (default: -j)')
    parser.add_argument(
        '-l',
        type=str,
        help='number of linker threads for the cling build (default: -j)')
    parser.add_argument('-v ',
                        '--version',
                        action='store_true',
                        help='print version of the container')
    args = parser.parse_args()

    if args.version:
        print(container_version)
        sys.exit(0)

    if args.j:
        threads = int(args.j)
        if threads < 1:
            raise ValueError('-j have to be greater than 0')
    else:
        threads = None

    if args.l:
        linker_threads = int(args.l)
        if linker_threads < 1:
            raise ValueError('-l have to be greater than 0')
    else:
        linker_threads = None

    xcc_gen = gn.XCC_gen(build_prefix=args.build_prefix,
                         threads=threads,
                         linker_threads=linker_threads)
    stage = xcc_gen.gen_release_single_stage()

    stage += label(metadata={'EXAMPLE_CONTAINER_MAINTAINER': 'Simeon Ehrig'})
    stage += label(metadata={'EXAMPLE_CONTAINER_EMAIL': '*****@*****.**'})
    stage += label(
        metadata={'EXAMPLE_CONTAINER_Version': str(container_version)})

    # disable the xsrf check, which avoid some problems in Firefox
    stage += copy(src='jupyter_notebook_config.py', dest='/')

    # copy and build the pnwriter library
    stage += packages(ospackages=['libpng-dev'])
    png_git = git()
    stage += png_git.clone_step(
        repository='https://github.com/pngwriter/pngwriter.git',
        branch='dev',
        path='/opt/')
    png_cmake = CMakeBuild()
    stage += shell(commands=[
        png_cmake.configure_step(directory='/opt/pngwriter',
                                 opts=['-DBUILD_SHARED_LIBS=ON']),
        png_cmake.build_step(target='install')
    ])

    # copy and install jitify
    jitify_git = git()
    stage += jitify_git.clone_step(
        repository='https://github.com/NVIDIA/jitify.git', path='/opt/')
    png_cmake = CMakeBuild()
    stage += shell(commands=['cp /opt/jitify/jitify.hpp /usr/local/include'])

    stage += shell(commands=['rm -rf /opt/pngwriter', 'rm -rf /opt/jitify'])

    # check if the path to the notebook is specified, otherwise use the current directory
    stage += runscript(commands=[
        'if [ $# -gt 0 ]', 'then', 'cd $1', 'fi',
        'jupyter-notebook --config=/jupyter_notebook_config.py'
    ])

    print(stage.__str__())