-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_apptainer_image.sh
More file actions
35 lines (28 loc) · 1 KB
/
build_apptainer_image.sh
File metadata and controls
35 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
#SBATCH -J build_apptainer_image
#SBATCH --mail-type=END,FAIL
#SBATCH --mail-user=Joan.Kant@uhn.ca
#SBATCH --partition=himem
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=20G
#SBATCH --time=02:00:00
#SBATCH --output=slurm_out/%x_%A.out
#SBATCH --error=slurm_out/%x_%A.out
# Adaptable SLURM script for building images from .tar files (Docker).
# Assuming that the PWD contains your .tar file and is also the destination
# TODO change your email in the SBATCH above
# TODO fill out
image_name="opt"
image_src="/cluster/projects/gaitigroup/Users/Joan/containers/opt/${image_name}.tar"
image_dest="/cluster/projects/gaitigroup/ref/singularity_images/${image_name}_dev.sif"
module load apptainer
export APPTAINER_CACHEDIR=$PWD/cache_${image_name}
export APPTAINER_TMPDIR=$PWD/tmp_${image_name}
mkdir -p $APPTAINER_CACHEDIR
mkdir -p $APPTAINER_TMPDIR
apptainer build ${image_dest} docker-archive:${image_src}
# Clean up
rm -rf $APPTAINER_CACHEDIR
rm -rf $APPTAINER_TMPDIR