Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpacking to Singularity #305

Draft
wants to merge 8 commits into
base: 1.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions reprounzip-singularity/.singularity.d/Singularity
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Bootstrap: docker
From: ubuntu:16.04

# =======================
# global
# =======================
%post
apt-get -y update

%environment
export LC_ALL=C
export PATH=/usr/games:$PATH

# =======================
# fortune
# =======================
%appinstall fortune
apt-get -y install fortune

%appenv fortune
BEST_APP=fortune
export BEST_APP

%apphelp fortune
fortune is the best app

%apprun fortune
fortune "$@"

# =======================
# cowsay
# =======================
%appinstall cowsay
apt-get -y install cowsay

%appenv cowsay
BEST_APP=cowsay
export BEST_APP

%apphelp cowsay
cowsay is the best app

%apprun cowsay
cowsay "$@"

# =======================
# lolcat
# =======================
%appinstall lolcat
apt-get -y install lolcat

%appenv lolcat
BEST_APP=lolcat
export BEST_APP

%apphelp lolcat
lolcat is the best app

%apprun lolcat
lolcat "$@"
9 changes: 9 additions & 0 deletions reprounzip-singularity/.singularity.d/actions/exec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

for script in /.singularity.d/env/*.sh; do
if [ -f "$script" ]; then
. "$script"
fi
done

exec "$@"
23 changes: 23 additions & 0 deletions reprounzip-singularity/.singularity.d/actions/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

for script in /.singularity.d/env/*.sh; do
if [ -f "$script" ]; then
. "$script"
fi
done

if test -n "${SINGULARITY_APPNAME:-}"; then

if test -x "/scif/apps/${SINGULARITY_APPNAME:-}/scif/runscript"; then
exec "/scif/apps/${SINGULARITY_APPNAME:-}/scif/runscript" "$@"
else
echo "No Singularity runscript for contained app: ${SINGULARITY_APPNAME:-}"
exit 1
fi

elif test -x "/.singularity.d/runscript"; then
exec "/.singularity.d/runscript" "$@"
else
echo "No Singularity runscript found, executing /bin/sh"
exec /bin/sh "$@"
fi
27 changes: 27 additions & 0 deletions reprounzip-singularity/.singularity.d/actions/shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

for script in /.singularity.d/env/*.sh; do
if [ -f "$script" ]; then
. "$script"
fi
done

if test -n "$SINGULARITY_SHELL" -a -x "$SINGULARITY_SHELL"; then
exec $SINGULARITY_SHELL "$@"

echo "ERROR: Failed running shell as defined by '\$SINGULARITY_SHELL'" 1>&2
exit 1

elif test -x /bin/bash; then
SHELL=/bin/bash
PS1="Singularity $SINGULARITY_CONTAINER:\\w> "
export SHELL PS1
exec /bin/bash --norc "$@"
elif test -x /bin/sh; then
SHELL=/bin/sh
export SHELL
exec /bin/sh "$@"
else
echo "ERROR: /bin/sh does not exist in container" 1>&2
fi
exit 1
15 changes: 15 additions & 0 deletions reprounzip-singularity/.singularity.d/actions/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# if we are here start notify PID 1 to continue
# DON'T REMOVE
kill -CONT 1

for script in /.singularity.d/env/*.sh; do
if [ -f "$script" ]; then
. "$script"
fi
done

if test -x "/.singularity.d/startscript"; then
exec "/.singularity.d/startscript"
fi
23 changes: 23 additions & 0 deletions reprounzip-singularity/.singularity.d/actions/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

for script in /.singularity.d/env/*.sh; do
if [ -f "$script" ]; then
. "$script"
fi
done


if test -n "${SINGULARITY_APPNAME:-}"; then

if test -x "/scif/apps/${SINGULARITY_APPNAME:-}/scif/test"; then
exec "/scif/apps/${SINGULARITY_APPNAME:-}/scif/test" "$@"
else
echo "No Singularity tests for contained app: ${SINGULARITY_APPNAME:-}"
exit 1
fi
elif test -x "/.singularity.d/test"; then
exec "/.singularity.d/test" "$@"
else
echo "No Singularity container test found, executing /bin/sh"
exec /bin/sh "$@"
fi
52 changes: 52 additions & 0 deletions reprounzip-singularity/.singularity.d/env/95-apps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
#
# Copyright (c) 2017-2018, SyLabs, Inc. All rights reserved.
# Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
#
# See the COPYRIGHT.md file at the top-level directory of this distribution and at
# https://github.com/singularityware/singularity/blob/master/COPYRIGHT.md.
#
# This file is part of the Singularity Linux container project. It is subject to the license
# terms in the LICENSE.md file found in the top-level directory of this distribution and
# at https://github.com/singularityware/singularity/blob/master/LICENSE.md. No part
# of Singularity, including this file, may be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE.md file.


if test -n "${SINGULARITY_APPNAME:-}"; then

# The active app should be exported
export SINGULARITY_APPNAME

if test -d "/scif/apps/${SINGULARITY_APPNAME:-}/"; then
SCIF_APPS="/scif/apps"
SCIF_APPROOT="/scif/apps/${SINGULARITY_APPNAME:-}"
export SCIF_APPROOT SCIF_APPS
PATH="/scif/apps/${SINGULARITY_APPNAME:-}:$PATH"

# Automatically add application bin to path
if test -d "/scif/apps/${SINGULARITY_APPNAME:-}/bin"; then
PATH="/scif/apps/${SINGULARITY_APPNAME:-}/bin:$PATH"
fi

# Automatically add application lib to LD_LIBRARY_PATH
if test -d "/scif/apps/${SINGULARITY_APPNAME:-}/lib"; then
LD_LIBRARY_PATH="/scif/apps/${SINGULARITY_APPNAME:-}/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
fi

# Automatically source environment
if [ -f "/scif/apps/${SINGULARITY_APPNAME:-}/scif/env/01-base.sh" ]; then
. "/scif/apps/${SINGULARITY_APPNAME:-}/scif/env/01-base.sh"
fi
if [ -f "/scif/apps/${SINGULARITY_APPNAME:-}/scif/env/90-environment.sh" ]; then
. "/scif/apps/${SINGULARITY_APPNAME:-}/scif/env/90-environment.sh"
fi

export PATH
else
echo "Could not locate the container application: ${SINGULARITY_APPNAME}"
exit 1
fi
fi

1 change: 1 addition & 0 deletions reprounzip-singularity/.singularity.d/startscript
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/sh
Loading