Exemplo n.º 1
0
def build(image="Characterisation-Virtual-Laboratory/CharacterisationVL-Software:2004", _bootstrap='shub', mash_version='v2.2.2', capnp_version='0.8.0', quicktree_version='v2.5'):
    stage0 = hpccm.Stage()
    hpccm.config.set_container_format("singularity")
    stage0 += baseimage(image=image, _bootstrap=_bootstrap, _distro='ubuntu20')
    stage0 += label(metadata={'maintainer': 'Luhan Cheng', 'email': '*****@*****.**'})
    stage0 += packages(ospackages=['cpanminus', 'libexpat1-dev', 'sqlite3', 'libsqlite3-dev', 'autoconf'])
    stage0 += generic_build(
        repository='https://github.com/khowe/quicktree',
        branch=quicktree_version,
        build=['make'],
        install=[
            'mv quicktree /usr/local/bin',
            'mv include/* /usr/local/include/'
        ],
    )
    stage0 += boost()
    stage0 += generic_autotools(
        url=f'https://capnproto.org/capnproto-c++-{capnp_version}.tar.gz'
    )
    stage0 += shell(commands=['cpanm -l /usr/local/perl5 --notest BioPerl Bio::Sketch::Mash DBD::SQLite DBI'])
    stage0 += generic_autotools(
        repository=f'https://github.com/marbl/Mash',
        preconfigure=['./bootstrap.sh'],
        branch=mash_version,
        with_capnp='/usr/local/',
        with_boost='/usr/local/boost/',
    )
    stage0 += environment(variables={'PERL5LIB': '$PERL5LIB:/usr/local', **from_prefix('/usr/local/mashtree')})
    stage0 += shell(commands=['cpanm -f -l /usr/local/mashtree Mashtree'])
    return stage0
Exemplo n.º 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 += conda(eula=True,
                    channels=['defaults', 'conda-forge', 'bioconda'],
                    packages=['python=3.6', 'nullarbor'])
    stage0 += environment(variables={'PATH': '/usr/local/anaconda/bin:$PATH'})

    return stage0
    def test_instruction_manipulations(self):
        """Instruction manipulations"""
        b = bb_base()

        # Append instructions
        b += shell(commands=['echo a'])
        # Append directly to "private" class variable (not recommended)
        b._bb_base__instructions.append(shell(commands=['echo b']))
        self.assertEqual(len(b), 2)
        self.assertEqual(str(b), 'RUN echo a\nRUN echo b')

        # Direct element access
        self.assertEqual(str(b[0]), 'RUN echo a')
        self.assertEqual(str(b[1]), 'RUN echo b')

        # Iterators
        i = iter(b)
        self.assertEqual(str(next(i)), 'RUN echo a')
        self.assertEqual(str(next(i)), 'RUN echo b')

        # Insertion, using "private" class variable (not recommended)
        b._bb_base__instructions.insert(0, shell(commands=['echo c']))
        self.assertEqual(len(b), 3)
        self.assertEqual(str(b), 'RUN echo c\nRUN echo a\nRUN echo b')

        # Deletion (not allowed)
        with self.assertRaises(TypeError):
            del(b[1])

        # Deletion via "private" class variable (not recommended)
        del(b._bb_base__instructions[1])
        self.assertEqual(len(b), 2)
        self.assertEqual(str(b), 'RUN echo c\nRUN echo b')
Exemplo n.º 4
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 -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 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales', 'zlib1g-dev'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    return stage0
Exemplo n.º 5
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 -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 += packages(apt=['wget', 'git', 'software-properties-common', 'build-essential', 'locales', 'zlib1g-dev'])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += packages(apt=['g++', 'clang', 'cmake', 'make', 'bison', 'flex', 'ronn', 'fuse3', 'pkg-config', 'binutils-dev', 'libarchive-dev', 'libboost-context-dev', 'libboost-filesystem-dev', 'libboost-program-options-dev', 'libboost-python-dev', 'libboost-regex-dev', 'libboost-system-dev', 'libboost-thread-dev', 'libevent-dev', 'libjemalloc-dev', 'libdouble-conversion-dev', 'libiberty-dev', 'liblz4-dev', 'liblzma-dev', 'libssl-dev', 'libunwind-dev', 'libdwarf-dev', 'libelf-dev', 'libfmt-dev', 'libfuse3-dev', 'libgoogle-glog-dev'])

    stage0 += generic_cmake(
        prefix='/usr/local/dwarfs',
        repository='https://github.com/mhx/dwarfs.git',
        branch='v0.5.5',
        recursive=True,
        cmake_opts=["-D WITH_TESTS=1"],
    )
    stage0 += environment(variables=from_prefix('/usr/local/dwarfs'))

    return stage0
Exemplo n.º 6
0
def build(container_format='singularity', os_release='ubuntu', os_version='20.04', gpu=True, cuda_version='11.0', desktop=True):
    config.set_container_format(container_format)
    if gpu:
        image = f'nvcr.io/nvidia/cuda:{cuda_version}-devel-{os_release}{os_version}'
    else:
        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 -f /bin/sh && ln -s /bin/bash /bin/sh',
        'rm -f /usr/bin/sh && ln -s /usr/bin/bash /usr/bin/sh',
        '/bin/bash',
    ])
    if gpu:
        stage0 += environment(variables=from_prefix('/usr/local/cuda'))
    stage0 += packages(apt=['wget', 'git', 'software-properties-common', 'build-essential', 'locales', 'zlib1g-dev'])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])
    if desktop:
        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'
        ])

    return stage0
Exemplo n.º 7
0
def build(container_format='singularity', os_release='ubuntu', os_version='20.04', gpu=True, cuda_version='11.0', desktop=True):
    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 -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 += packages(apt=['wget', 'git', 'software-properties-common', 'build-essential', 'locales', 'zlib1g-dev', 'dirmngr', 'gpg-agent'])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])
    stage0 += shell(commands=[
        "wget -O- http://neuro.debian.net/lists/bionic.us-ca.full | tee /etc/apt/sources.list.d/neurodebian.sources.list",
        "apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9 2>&1",
    ])
    stage0 += packages(apt=["fsl-complete"])



    return stage0
Exemplo n.º 8
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 -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 += 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'
    ])

    # coin3d
    stage0 += packages(apt=[
        'mesa-common-dev', 'libglu1-mesa-dev', 'freeglut3-dev', 'autoconf',
        'autogen', 'doxygen'
    ])
    compiler = gnu(version="10")
    stage0 += compiler
    stage0 += boost()
    stage0 += generic_cmake(
        repository="https://github.com/coin3d/coin",
        recursive=True,
        cmake_opts=[
            '-G "Unix Makefiles"', "-DCMAKE_BUILD_TYPE=Release",
            "-DCOIN_BUILD_DOCUMENTATION=OFF",
            "-DCMAKE_INSTALL_PREFIX=/usr/local/coin3d"
        ],
        postinstall=['cd cpack.d', 'cpack --config debian.cmake'])

    return stage0
Exemplo n.º 9
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'nvcr.io/nvidia/cuda:{cuda_version}-devel-{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'
    ])
    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 += packages(apt=[
        "qt5-qmake", 'qtmultimedia5-dev', 'libqt5multimediawidgets5',
        'libqt5multimedia5-plugins', 'libqt5multimedia5', 'libglew-dev',
        'glew-utils', 'libqglviewer-dev-qt5', 'libnetcdf-dev',
        'libnetcdf-cxx-legacy-dev', 'freeglut3-dev', 'libassimp-dev'
    ])
    stage0 += shell(commands=[
        'mkdir -p /opt/', "cd /opt",
        'git clone --branch v-2.7linux https://github.com/nci/drishti.git',
        'cd drishti/drishti', 'qmake -qt=5',
        'export LDFLAGS="$LDFLAGS -L/usr/lib/x86_64-linux-gnu/ -lassimp"',
        'ln -s /usr/lib/x86_64-linux-gnu/libQGLViewer-qt5.so /usr/lib/x86_64-linux-gnu/libQGLViewer.so',
        'make'
    ])

    return stage0
Exemplo n.º 10
0
    def test_runtime_instructions(self):
        """Instruction manipulations"""
        b = bb_base()

        # A non-runtime instruction that should not appear
        b += shell(commands=['echo a'])

        b.rt += shell(commands=['echo r1'])
        b.rt += shell(commands=['echo r2'])
        self.assertEqual(len(b.rt), 2)
        self.assertEqual(str(b.rt), 'RUN echo r1\nRUN echo r2')
Exemplo n.º 11
0
def build(container_format='singularity',
          os_release='ubuntu',
          os_version='20.04',
          openmpi_version='3.1.6',
          gnu_version='10',
          ucx_version="1.12.1",
          cuda_version='11.0',
          gdrcopy_version="1.3",
          knem_version="1.1.3"):
    config.set_container_format(container_format)

    image = f'nvcr.io/nvidia/cuda:{cuda_version}-devel-{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 += environment(variables=from_prefix('/usr/local/cuda'))
    stage0 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales', 'zlib1g-dev'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])
    stage0 += gnu(version=gnu_version)

    stage0 += gdrcopy(version=gdrcopy_version, ldconfig=True)
    stage0 += knem(version=knem_version, ldconfig=True)
    stage0 += ucx(knem='/usr/local/knem', version=ucx_version, ldconfig=True)
    stage0 += openmpi(cuda=False,
                      infiniband=True,
                      version=openmpi_version,
                      ucx="/usr/local/ucx",
                      ldconfig=True)

    # stage0 += shell(commands=[
    #     f'mkdir -p {TESTCASE_DIR} && cd {TESTCASE_DIR}',
    #     *[f'wget {i}' for i in TESTCASES],
    #     'for i in *;do echo $i;done'
    # ])

    return stage0
Exemplo n.º 12
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 -f /bin/sh && ln -s /bin/bash /bin/sh',
        'rm -f /usr/bin/sh && ln -s /usr/bin/bash /usr/bin/sh', '/bin/bash',
        'ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6'
    ])
    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 += primitives.copy(src='./ChimeraX-1.2.5.tar.gz',
                              dest='/opt/ChimeraX-1.2.5.tar.gz')
    stage0 += shell(commands=[
        'tar xfv /opt/ChimeraX-1.2.5.tar.gz -C /opt',
        'rm /opt/ChimeraX-1.2.5.tar.gz'
    ])
    stage0 += environment(
        variables=from_prefix('/opt/chimerax-1.2.5-rc-2021.05.24'))

    return stage0
Exemplo n.º 13
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__())
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 -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 += packages(apt=['wget', 'git', 'software-properties-common', 'build-essential', 'locales', 'zlib1g-dev', 'bc', 'cmake',
                            'bison', 'flex', 'libx11-dev', 'x11proto-core-dev', 'libxi6', 'libxi-dev', 'libxmu6', 'libxmu-dev',
                            'libxmu-headers', 'libgl1-mesa-dev', 'libglu1-mesa-dev', 'libjpeg-dev', 'libevent-dev', 'libncurses-dev',
                            'pkg-config', 'libopenblas-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 += generic_cmake(
        repository='https://github.com/BIC-MNI/minc-toolkit-v2.git',
        branch='release-1.9.18.1',
        recursive=True,
        prefix='/opt/minc/1.9.18',
        preconfigure=['sed -i -e \'s/http\:\/\/mirrors\.ibiblio\.org\/gnu\/ftp\/gnu\/gsl/http\:\/\/ftp\.\sun\.ac\.za\/ftp\/pub\/mirrors\/ftp\.gnu\.org\/gsl/g\' cmake-modules/BuildGSL.cmake', ],
        cmake_opts=['-DCMAKE_BUILD_TYPE:STRING=Release', '-DCMAKE_INSTALL_PREFIX:PATH=/opt/minc/1.9.18', '-DMT_BUILD_ABC:BOOL=ON',
                    '-DMT_BUILD_ANTS:BOOL=ON', '-DMT_BUILD_C3D:BOOL=ON', '-DMT_BUILD_ELASTIX:BOOL=ON', '-DMT_BUILD_IM:BOOL=OFF',
                    '-DMT_BUILD_ITK_TOOLS:BOOL=ON', '-DMT_BUILD_LITE:BOOL=OFF', '-DMT_BUILD_SHARED_LIBS:BOOL=ON', '-DMT_BUILD_VISUAL_TOOLS:BOOL=ON',
                    '-DMT_USE_OPENMP:BOOL=ON', '-DUSE_SYSTEM_FFTW3D:BOOL=OFF', '-DUSE_SYSTEM_FFTW3F:BOOL=OFF', '-DUSE_SYSTEM_GLUT:BOOL=OFF',
                    '-DUSE_SYSTEM_GSL:BOOL=OFF', '-DUSE_SYSTEM_HDF5:BOOL=OFF', '-DUSE_SYSTEM_ITK:BOOL=OFF', '-DUSE_SYSTEM_NETCDF:BOOL=OFF',
                    '-DUSE_SYSTEM_NIFTI:BOOL=OFF', '-DUSE_SYSTEM_PCRE:BOOL=OFF', '-DUSE_SYSTEM_ZLIB:BOOL=OFF']
    )
    stage0 += environment(variables=from_prefix('/opt/minc/1.9.18.1'))
    return stage0
Exemplo n.º 15
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 -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 += 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', 'cmake', 'libgtk2.0-dev', 'libasound2-dev',
        'libavformat-dev', 'libjack-jackd2-dev', 'uuid-dev'
    ])
    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=['pip install conan'])
    stage0 += generic_cmake(repository='https://github.com/audacity/audacity/',
                            branch='Audacity-3.0.5')

    return stage0
Exemplo n.º 16
0
def main():
    ############################################################################
    # setup basics
    ############################################################################
    hpccm.config.set_container_format('singularity')
    hpccm.config.set_singularity_version('3.3')

    stage0 = hpccm.Stage()
    stage0 += baseimage(image='ubuntu:bionic')

    stage0 += packages(ospackages=[
        'git', 'g++', 'wget', 'pkg-config', 'less', 'uuid-dev', 'gdb',
        'locales', 'gpg-agent', 'gnupg2', 'locales-all', 'unzip'
    ])
    # set language to en_US.UTF-8 to avoid some problems with the cling output system
    stage0 += shell(
        commands=['locale-gen en_US.UTF-8', 'update-locale LANG=en_US.UTF-8'])

    ############################################################################
    # install clang/llvm
    ############################################################################
    stage0 += llvm(version='9', extra_repository=True)

    ############################################################################
    # install ninja build system
    ############################################################################
    stage0 += shell(commands=[
        'cd /opt', 'wget --no-check-certificate ' +
        'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip',
        'unzip ninja-linux.zip', 'mv ninja /usr/local/bin/',
        'rm ninja-linux.zip', 'cd -'
    ])

    ############################################################################
    # install cmake
    ############################################################################
    stage0 += cmake(eula=True, version='3.16.1')

    ############################################################################
    # write recipe.def
    ############################################################################
    with open('recipe.def', 'w') as filehandle:
        filehandle.write(stage0.__str__())
Exemplo n.º 17
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
Exemplo n.º 18
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 -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 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales', 'zlib1g-dev'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += packages(apt=[
        'perl', 'libmodule-install-perl', 'libxml-parser-perl', 'cpanminus'
    ])
    stage0 += shell(commands=[
        'cpanm inc::latest',
        'cpanm BioPerl Bio::SeqIO Getopt::Euclid List::Util Math::Random::MT version'
    ])
    stage0 += shell(commands=[
        'wget https://sourceforge.net/projects/biogrinder/files/biogrinder/Grinder-0.5.4/Grinder-0.5.4.tar.gz && tar -xf Grinder-0.5.4.tar.gz && rm Grinder-0.5.4.tar.gz',
        'cd Grinder-0.5.4', 'perl Makefile.PL', 'make', 'make install'
    ])

    return stage0
Exemplo n.º 19
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',
                            'perl', 'openssh-server', 'libssl-dev', 'gnuplot', 'globus-gridftp-server-progs', 'rsync', 'acl-dev'])
    stage0 += gnu(version='10')
    stage0 += shell(commands=[
        'yes | cpan Data::MessagePack',
        'yes | cpan IO::Socket::SSL'
    ])

    stage0 += generic_build(
        repository='https://github.com/eeertekin/bbcp.git',
        commit='64af832',
        prefix='/usr/local/bbcp/',
        build=['make -C src'],
        install=['mv bin/amd64_linux/bbcp /usr/local/bbcp/']
    )
    stage0 += environment(variables=add_binary('/usr/local/bbcp'))

    stage0 += generic_build(
        repository='https://github.com/pkolano/shift.git',
        commit='ffb7f5f',
        prefix='/usr/local/shift',
        directory='shift/c',
        build=['make nolustre'],
        install=['mdkir /usr/local/shift/bin && mv c/shift-bin /usr/local/shift/bin']
    )
    return stage0
Exemplo n.º 20
0
def install_ninja(stage: hpccm.Stage):
    """Install ninja build system

    :param stage: hpccm stage
    :type stage: hpccm.Stage

    """
    stage += shell(commands=[
        'cd /opt',
        'wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip',
        'unzip ninja-linux.zip', 'mv ninja /usr/local/bin/',
        'rm ninja-linux.zip', 'cd -'
    ])
Exemplo n.º 21
0
def build():
    stage0 = Stage()
    config.set_container_format('singularity')
    stage0 += baseimage(image='ubuntu:18.04')
    stage0 += nvhpc(
        eula=True,
        mpi=True,
    )

    stage0 += copy(src='heat_mpi.f90', dest='/var/tmp/heat_mpi.f90')
    stage0 += shell(
        commands=['mpif90 /var/tmp/heat_mpi.f90 -o /usr/local/bin/heat_mpi'])
    return stage0
Exemplo n.º 22
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
Exemplo n.º 23
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
def install_alpaka(stage: hpccm.Stage):
    """Install alpaka 0.4 to /usr/local/include

    :param stage: the hpccm stage
    :type stage: hpccm.Stage

    """
    cm = []
    git_conf = git()
    cm.append(
        git_conf.clone_step(
            repository=
            'https://github.com/ComputationalRadiationPhysics/alpaka',
            branch='release-0.4.0',
            path='/opt'))
    cm.append('cp -r /opt/alpaka/include/alpaka /usr/include/')
    cm.append('rm -rf /opt/alpaka')
    stage += shell(commands=cm)
def build_jupyter_kernel(stage: hpccm.Stage):
    """Add the different Alpaka kernel versions to Jupyter Notebook.

    :param stage: the hpccm stage
    :type stage: hpccm.Stage

    """
    kernel_register = []
    kernel_register.append('mkdir -p /opt/miniconda3/share/jupyter/kernels/')
    kernel_register.append('cd /opt/miniconda3/share/jupyter/kernels/')
    for std in [11, 14, 17]:
        # without and with CUDA mode
        for acc in ['', '-cuda']:
            kernel_path = 'alpaka-cpp' + str(std) + acc
            kernel_register.append('mkdir -p ' + kernel_path)
            kernel_register.append("echo '" + gen_jupyter_kernel(std, acc) +
                                   "' > " + kernel_path + "/kernel.json")

    kernel_register.append('cd -')
    stage += shell(commands=kernel_register)
def add_clang(stage: hpccm.Stage, ubuntu_version: str, version: str):
    """Add commands to stage to install clang.

    :param stage: hpccm Stage
    :type stage: hpccm.Stage
    :param ubuntu_version: Ubuntu version number: '16.04' or '18.04'
    :type ubuntu_version: str
    :param version: Clang version: 5.0 - 7.0 or 8 - 9
    :type version: str

    """
    if ubuntu_version == '16.04':
        distro_name = 'xenial'
    elif ubuntu_version == '18.04':
        distro_name = 'bionic'
    else:
        print('clang error: unsupported Ubuntu version: ' + ubuntu_version,
              file=sys.stderr)
        print('supported Ubuntu version: 16.04, 18.04', file=sys.stderr)
        return

    # clang/llvm changed its name pattern and the ppa sources with clang 8
    # https://apt.llvm.org/
    ppa_version = '' if float(version) < 8.0 else '-' + str(version)

    stage += shell(commands=[
        'wget http://llvm.org/apt/llvm-snapshot.gpg.key',
        'apt-key add llvm-snapshot.gpg.key', 'rm llvm-snapshot.gpg.key',
        'echo "" >> /etc/apt/sources.list', 'echo "deb http://apt.llvm.org/' +
        distro_name + '/ llvm-toolchain-' + distro_name + ppa_version +
        ' main" >> /etc/apt/sources.list',
        'echo "deb-src http://apt.llvm.org/' + distro_name +
        '/ llvm-toolchain-' + distro_name + ppa_version +
        ' main" >> /etc/apt/sources.list'
    ])
    stage += llvm(version=str(version))
Exemplo n.º 27
0
def build(container_format='singularity',
          os_release='ubuntu',
          os_version='20.04',
          cuda_version='11.0.3'):
    config.set_container_format(container_format)

    # image = f'{os_release}:{os_version}'
    image = f'nvcr.io/nvidia/cuda:{cuda_version}-devel-{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 += packages(apt=[
        'wget', 'git', 'software-properties-common', 'build-essential',
        'locales', 'zlib1g-dev'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += packages(apt=[
        'freeglut3-dev', 'build-essential', 'libx11-dev', 'libxmu-dev',
        'libxi-dev', 'libglu1-mesa', 'libglu1-mesa-dev', 'mesa-utils',
        'libgl1-mesa-glx'
    ])
    stage0 += environment(variables=from_prefix('/usr/local/cuda'))

    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 += packages(apt=[
        'make', 'libopenmpi-dev', 'python3-tk', 'libfftw3-dev', 'libhdf5-dev',
        'libtiff-dev', 'libjpeg-dev', 'libsqlite3-dev', 'openjdk-8-jdk'
    ])
    stage0 += environment(
        variables={
            'LD_LIBRARY_PATH':
            "$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/hdf5/serial",
        })
    prefix = '/usr/local/scipion'

    stage0 += shell(commands=[
        'python3 -m pip install --user scipion-installer',
        f'python3 -m scipioninstaller {prefix} -j 4'
    ])
    stage0 += environment(variables=from_prefix(prefix))
    return stage0
def add_alpaka_dep_layer(stage: hpccm.Stage,
                         ubuntu_version: str,
                         cuda_support: bool,
                         extra_compiler: List[str],
                         alpaka=False) -> bool:
    """Add all dependencies to an hpccm stage that are necessary to build and run Alpaka.

    :param stage: At least a baseimage
    :type stage: hpccm.Stage
    :param ubuntu_version: Ubuntu version number: '16.04' or '18.04'
    :type ubuntu_version: str
    :param cuda_support: Set True, if the Stage supports CUDA
    :type cuda_support: bool
    :param extra_compiler: List of compilers, which are installed additional to the system compiler. Supported are: gcc:[5-9], clang:[5.0-7.0, 8-9]
    :type extra_compiler: str
    :param alpaka: install alpaka in /usr/local
    :type alpaka: bool
    :returns: Returns True if function was successful
    :rtype: bool

    """
    if ubuntu_version != '16.04' and ubuntu_version != '18.04':
        print('not supported Ubuntu version: ' + ubuntu_version,
              file=sys.stderr)
        print('supported are: 16.04, 18.04', file=sys.stderr)
        return False

    apt_package_list = [
        'gcc', 'g++', 'make', 'software-properties-common', 'wget',
        'libc6-dev', 'libomp-dev', 'unzip', 'git'
    ]

    if ubuntu_version == '16.04':
        apt_package_list.append('gnupg-agent')
    if ubuntu_version == '18.04':
        apt_package_list.append('gpg-agent')

    stage += packages(ospackages=apt_package_list)

    stage += cmake(eula=True, version='3.16.0')

    # install extra compiler
    if extra_compiler is not None:
        for com in extra_compiler:
            if com.startswith('gcc'):
                stage += gnu(extra_repository=True, version=com[len('gcc:'):])
            if com.startswith('clang'):
                add_clang(stage, ubuntu_version, version=com[len('clang:'):])

    #install boost
    stage += shell(
        commands=['add-apt-repository -y ppa:mhier/libboost-latest'])
    stage += packages(ospackages=['boost1.67'])

    if cuda_support:
        stage += environment(
            variables={
                'LD_LIBRARY_PATH': '$LD_LIBRARY_PATH:/usr/local/cuda/lib64'
            })
        # alpaka use a function direct from the cuda driver library
        # in the container, the cuda libraries are not at the default path
        stage += environment(
            variables={
                'LIBRARY_PATH': '$LIBRARY_PATH:/usr/local/cuda/lib64/stubs'
            })
        stage += environment(
            variables={'CMAKE_PREFIX_PATH': '/usr/local/cuda/lib64/stubs/'})

    if alpaka:
        git_alpaka = git()
        cmake_alpaka = CMakeBuild()
        alpaka_commands = []
        alpaka_commands.append(
            git_alpaka.clone_step(
                repository='https://github.com/alpaka-group/alpaka.git',
                path='/opt'))
        alpaka_commands.append(
            cmake_alpaka.configure_step(
                build_directory='build',
                directory='/opt/alpaka',
                opts=['-Dalpaka_BUILD_EXAMPLES=OFF', '-DBUILD_TESTING=OFF']))
        alpaka_commands.append(cmake_alpaka.build_step(target='install'))
        alpaka_commands.append('rm -rf /opt/alpaka')

        stage += shell(commands=alpaka_commands)

    return True
Exemplo n.º 29
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]
Exemplo n.º 30
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', 'perl', 'ncbi-blast+', 'libx11-dev'
    ])
    stage0 += shell(commands=['locale-gen en_AU.UTF-8'])

    stage0 += gnu(version='10')

    stage0 += generic_build(
        url=
        'http://search.cpan.org/CPAN/authors/id/Y/YA/YANICK/Parallel-ForkManager-1.19.tar.gz',
        prefix='/usr/local/parallel-forkmanager',
        build=['perl Makefile.PL', 'make install'],
        install=['mv * /usr/local/parallel-forkmanager/'])
    stage0 += environment(
        variables=add_binary('/usr/local/parallel-forkmanager'))

    stage0 += generic_build(
        url=
        'ftp://ftp.ebi.ac.uk/pub/software/clustalw2/2.1/clustalw-2.1-linux-x86_64-libcppstatic.tar.gz',
        prefix='/usr/local/clustalw',
        install=['mv clustalw2 /usr/local/clustalw/clustalw'])
    stage0 += environment(variables=add_binary('/usr/local/clustalw'))

    stage0 += generic_autotools(
        url='ftp://emboss.open-bio.org/pub/EMBOSS/EMBOSS-6.6.0.tar.gz',
        prefix='/usr/local/emboss',
    )
    stage0 += environment(variables=from_prefix('/usr/local/emboss'))

    stage0 += generic_autotools(
        url=
        'https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_4_x/ViennaRNA-2.4.17.tar.gz',
        prefix='/usr/local/viennarna')
    stage0 += environment(variables=from_prefix('/usr/local/viennarna'))

    stage0 += generic_build(
        url='https://github.com/weizhongli/cdhit/archive/V4.8.1.tar.gz',
        prefix='/usr/local/cdhit',
        directory='cdhit-4.8.1',
        build=['make'],
        install=['mv * /usr/local/cdhit/'])
    stage0 += environment(variables=add_binary('/usr/local/cdhit'))

    stage0 += generic_build(
        repository='https://github.com/ambarishbiswas/CRISPRDetect_2.2.git',
        commit='0f8249f',
        prefix='/usr/local/crisprdetect',
        install=['mv * /usr/local/crisprdetect/'])
    stage0 += environment(variables=add_binary('/usr/local/crisprdetect'))
    return stage0