From 0efcb9253588a0d33074b3121204730907d70b89 Mon Sep 17 00:00:00 2001
From: Marty Kandes <mkandes@sdsc.edu>
Date: Sun, 2 May 2021 22:53:27 +0000
Subject: [PATCH] Add Singularity.singularity-3.5.3

This is a testbed container to explore the potential use cases of
running Singularity within a Singularity container.
---
 .../singularity/Singularity.singularity-3.5.3 | 151 ++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100644 definition-files/singularity/Singularity.singularity-3.5.3

diff --git a/definition-files/singularity/Singularity.singularity-3.5.3 b/definition-files/singularity/Singularity.singularity-3.5.3
new file mode 100644
index 0000000..b641920
--- /dev/null
+++ b/definition-files/singularity/Singularity.singularity-3.5.3
@@ -0,0 +1,151 @@
+Bootstrap: debootstrap
+MirrorURL: http://us.archive.ubuntu.com/ubuntu
+OSVersion: focal
+
+%labels
+
+    APPLICATION_NAME Singularity
+    APPLICATION_VERSION 3.5.3
+    APPLICATION_URL https://sylabs.io/guides/3.5/user-guide/
+
+    AUTHOR_NAME Marty Kandes
+    AUTHOR_EMAIL mkandes@sdsc.edu
+
+    LAST_UPDATED 20210425
+
+%setup
+
+%environment
+ 
+    # Set operating system mirror URL
+    export MIRRORURL='http://us.archive.ubuntu.com/ubuntu'
+
+    # Set operating system version
+    export OSVERSION='focal'
+
+    # Set system locale
+    export LC_ALL='C'
+
+    # Set debian frontend interface
+    export DEBIAN_FRONTEND='noninteractive'
+
+%post -c /bin/bash
+
+    # Set operating system mirror URL
+    export MIRRORURL='http://us.archive.ubuntu.com/ubuntu'
+
+    # Set operating system version
+    export OSVERSION='focal'
+
+    # Set system locale
+    export LC_ALL=C
+
+    # Set debian frontend interface
+    export DEBIAN_FRONTEND='noninteractive'
+
+    # Install system metapackages
+    apt-get -y install ubuntu-standard
+    apt-get -y install ubuntu-server
+
+    # Add repositories
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION} main"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION} universe"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION} multiverse"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION} restricted"
+
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-updates main"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-updates universe"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-updates multiverse"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-updates restricted"
+
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-backports main"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-backports universe"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-backports multiverse"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-backports restricted"
+
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-security main"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-security universe"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-security multiverse"
+    add-apt-repository -y "deb ${MIRRORURL} ${OSVERSION}-security restricted"
+
+    # Upgrade all software packages to their latest versions
+    apt-get -y update && apt-get -y upgrade
+
+    # Install common packages from 'main'
+    apt-get -y install autoconf
+    apt-get -y install automake
+    apt-get -y install build-essential
+    apt-get -y install cmake
+    apt-get -y install evince
+    apt-get -y install expect
+    apt-get -y install gfortran
+    apt-get -y install libtool
+    apt-get -y install mlocate
+    apt-get -y install pkg-config
+    apt-get -y install wget
+    apt-get -y install zip
+
+    # Install Singularity dependencies
+    apt-get -y install build-essential
+    apt-get -y install libssl-dev
+    apt-get -y install uuid-dev
+    apt-get -y install libgpgme-dev
+    apt-get -y install squashfs-tools
+    apt-get -y install libseccomp-dev
+    apt-get -y install wget
+    apt-get -y install pkg-config
+    apt-get -y install git
+    apt-get -y install cryptsetup-bin
+    apt-get -y install debootstrap
+    apt-get -y install uidmap
+
+    mkdir -p /tmp/go
+    cd /tmp/go
+
+    export CGO_ENABLED=0
+    wget https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
+    tar -xf go1.4-bootstrap-20171003.tar.gz
+    mv go 1.4
+    cd 1.4/src
+    ./make.bash
+
+    export GOROOT_BOOTSTRAP='/tmp/go/1.4'
+
+    cd /tmp/go
+
+    export GO_VERSION='1.15.6'
+
+    export CGO_ENABLED=1
+    git clone https://go.googlesource.com/go "${GO_VERSION}"
+    cd "${GO_VERSION}"
+    git checkout "go${GO_VERSION}"
+    cd src
+    ./all.bash
+
+    export GOROOT="/tmp/go/${GO_VERSION}"
+    export PATH="${GOROOT}/bin:${PATH}"
+
+    cd /tmp
+
+    export SINGULARITY_VERSION='3.5.3'
+
+    # Installing Singularity
+    wget "https://github.com/hpcng/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-${SINGULARITY_VERSION}.tar.gz"
+    tar -xf "singularity-${SINGULARITY_VERSION}.tar.gz"
+    cd singularity
+    ./mconfig #--prefix=/opt/singularity
+    make -C ./builddir
+    make -C ./builddir install
+
+    # Cleanup
+    apt-get -y autoremove --purge
+    apt-get -y clean
+
+    # Update database for mlocate
+    updatedb
+
+%files
+
+%runscript
+
+%test
-- 
GitLab