Skip to content
Snippets Groups Projects
Commit 6872f3d0 authored by Michael Blaschek's avatar Michael Blaschek :bicyclist:
Browse files

restructured repo, gitlab ci

parent 1939a97a
No related branches found
No related tags found
No related merge requests found
Showing
with 68 additions and 101 deletions
......@@ -3,19 +3,24 @@ image:
entrypoint: ["/bin/sh", "-c"]
variables:
sfile: definition-files/almalinux/Singularity.base
libarypath: almalinux:8-base
SFILE:
description: "file path of Singularity recipe file"
value: definition-files/Singularity.almalinux.base
CONTAINERTAG:
description: "registry name and tag, e.g. almalinux8:base"
value: almalinux8:base
build:
when: manual
script:
- pwd
- cp definition-files/runscript $PWD/
- cp definition-files/run-help $PWD/
- cd ./definition-files
# step 1. build the container!
- /bin/bash .gitlabci/build.sh $sfile
- /bin/bash build.sh $SFILE
# step 2. push to harbor
- singularity push ${sfile}.sif oras://harbor.wolke.img.univie.ac.at/apptainer/${librarypath}
- singularity push $SFILE.sif oras://harbor.wolke.img.univie.ac.at/apptainer/$CONTAINERTAG
# might be too big at some point
artifacts:
when: on_success
expire_in: 1 day
paths:
- ${sfile}.sif
- $SFILE.sif
# This is a makefile for building singularity containers
# from the definition files.
CONTAINER_DIR := containers
null :=
output:
@mkdir -p $(CONTAINER_DIR)
.PHONY: alma8.base # AlmaLinux 8 Base Image
alma8.base: output
@if [ ! -f '$(CONTAINER_DIR)/$@.sif' ]; then \
echo Building AlmaLinux 8 Base image: $(CONTAINER_DIR)/$@.sif;\
sudo singularity build $(CONTAINER_DIR)/$@.sif definition-files/almalinux/Singularity.base;\
fi
@[ -f $(CONTAINER_DIR)/$@.sif ] && echo Exists: $(CONTAINER_DIR)/$@.sif || true
.PHONY: alma8.met # AlmaLinux 8 Meteorology Image
alma8.met: output
@if [ ! -f $(CONTAINER_DIR)/$@.sif ]; then \
echo Building AlmaLinux 8 Met image: $(CONTAINER_DIR)/alma8.met.sif;\
sudo singularity build $(CONTAINER_DIR)/alma8.met.sif definition-files/almalinux/Singularity.met;\
fi
@[ -f $(CONTAINER_DIR)/$@.sif ] && echo Exists: $(CONTAINER_DIR)/$@.sif || true
.PHONY: alma8.met.ompi # AlmaLinux 8 Meteorology OMPI Image
alma8.met.ompi: output
@if [ ! -f $(CONTAINER_DIR)/$@.sif ]; then \
echo Building AlmaLinux 8 Met OMPI image: $(CONTAINER_DIR)/alma8.met.ompi.sif;\
sudo singularity build $(CONTAINER_DIR)/alma8.met.ompi.sif definition-files/almalinux/Singularity.met.ompi;\
fi
@[ -f $(CONTAINER_DIR)/$@.sif ] && echo Exists: $(CONTAINER_DIR)/$@.sif || true
.PHONY: help # Show make targets
help: # Show list of target
@echo Build Targets and helper functions:
@grep "^.PHONY: .* #" Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 \t\2/' | expand -t20
.PHONY: clean # Remove all container images
clean:
rm -rf $(CONTAINER_DIR)/*.sif
\ No newline at end of file
# Singularity / Apptainer
A repository of definition files for building [Singularity](https://sylabs.io/guides/latest/user-guide) containers around the software applications, frameworks, and libraries you need to run on high-performance computing systems.
A repository of definition files for building [Singularity](https://apptainer.org/docs/user/main/introduction.html) containers around the software applications, frameworks, and libraries you need to run on high-performance computing systems.
Based on [naked-singularity](https://github.com/mkandes/naked-singularity). Thanks M. Kandas
......@@ -8,31 +8,20 @@ Based on [naked-singularity](https://github.com/mkandes/naked-singularity). Than
## Install Singularity / Apptainer
Install Singularity on your Linux desktop, laptop, or virtual machine. You need *root* permissions to use and install the package.
Install Singularity/Apptainer on your Linux desktop, laptop, or virtual machine. You need *root* permissions to use and install the package. Although there is a unprivileged installation possible, [here](https://apptainer.org/docs/admin/main/installation.html#install-unprivileged-from-pre-built-binaries).
There is a general install script that installs version 3.5.3 (can be easily changed to 3.8 or 3.9) from source, but there are also binary packages build for modern OS (Server OS).
e.g. Red Hat, Arch, ...
Use the instructions from [apptainer](https://apptainer.org/docs/admin/main/installation.html)
more informaiton on building from source can be found here: [Installing Singularity Documentation](https://sylabs.io/guides/3.6/admin-guide/installation.html#)
```bash
# Centos / Red Hat
sudo yum update -y && \
sudo yum install -y epel-release && \
sudo yum update -y && \
sudo yum install -y singularity
# Arch / Manjaro
sudo pamac install singularity-container
# Manual using this script (builds from source)
sudo ./install-singularity.sh install
```sh title='Apptainer install instructions'
# Red Hat Based
sudo yum install -y epel-release
sudo yum install -y apptainer
# Ubuntu
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer
```
e.g. Ubuntu does not have the package in the repos, but a deb file exists in the releases. See below.
Please note that these versions can vary substantially. Please check that at least version 3.5 is available or for newer distributions use **apptainer**.
### prebuild binary releases
If you can not find singularity or apptainer in your repos, there are prebuild packages available as well. Go to the github release [singularity](https://github.com/sylabs/singularity/releases) or [apptainer](https://github.com/apptainer/apptainer/releases) page.
......
SFILES := $(wildcard Singularity.*)
%.sif:%
sudo singularity build $@ $<
$(addsuffix .sif, $(SFILES)): $(SFILES)
.PHONY: list
list:
@LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
clean:
rm -f *.sif
\ No newline at end of file
......@@ -5,8 +5,8 @@ From: almalinux:8
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
runscript /.singularity.d/runscript
run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
# command prompt name
......
......@@ -5,8 +5,8 @@ From: almalinux:8
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
dnf update -y \
......
......@@ -5,8 +5,8 @@ From: almalinux:8
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
# Every line will be a layer in the container
......
......@@ -5,8 +5,8 @@ From: almalinux:8
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
# Every line will be a layer in the container
......
......@@ -5,8 +5,8 @@ From: alpine
MAINTAINER Michael Blaschek <michael.blaschek@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
apk add --no-cache build-base \
......
......@@ -5,8 +5,8 @@ From: texlive/texlive:latest
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
# command prompt name
......
......@@ -5,8 +5,8 @@ From: mambaorg/micromamba:latest
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
apt -y update && apt -y install \
......
......@@ -7,8 +7,8 @@ From: mambaorg/micromamba:latest
eccodes 2.27.0
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
micromamba -q install -y -n base -c conda-forge eccodes=2.27.0 python=3.9.13 &&
......
......@@ -5,8 +5,8 @@ From: mambaorg/micromamba:latest
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%apprun install-ipykernel
# install current container as kernel
......
......@@ -5,8 +5,8 @@ From: mambaorg/micromamba:latest
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%apprun mpitest
......@@ -18,7 +18,7 @@ From: mambaorg/micromamba:latest
exec mpirun -np $nproc mpitest.x
%appfiles mpitest
./definition-files/MPI/mpitest.c ./mpitest.c
./src/mpitest.c ./mpitest.c
%appinstall mpitest
export PATH=/opt/conda/bin:$PATH
......
......@@ -5,8 +5,8 @@ From: ubuntu:18.04
maintainer IT-IMGW <it.img-wien@univie.ac.at>
%files
$PWD/definition-files/runscript /.singularity.d/runscript
$PWD/definition-files/run-help /.singularity.d/runscript.help
./runscript /.singularity.d/runscript
./run-help /.singularity.d/runscript.help
%post
# command prompt name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment