This repository has been archived by the owner on Dec 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_intel_app_container.sh
executable file
·66 lines (53 loc) · 2.09 KB
/
build_intel_app_container.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# © Copyright 2020-2020 UCAR
# This software is licensed under the terms of the Apache Licence Version 2.0 which can be obtained at
# http://www.apache.org/licenses/LICENSE-2.0.
#------------------------------------------------------------------------
function get_ans {
ans=''
while [[ $ans != y ]] && [[ $ans != n ]]; do
echo $1
read ans < /dev/stdin
if [[ -z $ans ]]; then ans=$defans; fi
if [[ $ans != y ]] && [[ $ans != n ]]; then echo "You must enter y or n"; fi
done
}
#------------------------------------------------------------------------
# This script creates and optionally distributes a new container
# It will create a docker container and optionally also a Charliecloud and
# a singularity container as well
set -ex
CNAME=${1:-"intel-impi-app"}
TAG=${2:-"beta"}
HPC=${3:-"0"}
# Stop if anything goes wrong
set -e
echo "Building Intel application container "
# create the Dockerfile
case ${HPC} in
"0")
hpccm --recipe ${CNAME}.py --format docker > Dockerfile.$CNAME
;;
"1")
hpccm --recipe ${CNAME}.py --userarg mellanox="True" \
--format docker > Dockerfile.$CNAME
;;
*)
echo "ERROR: unsupported HPC option"
exit 1
;;
esac
echo "=============================================================="
echo " Building Docker Image"
echo "=============================================================="
# process the Dockerfile to change to bash shell
sed -i '/DOCKERSHELL/c\SHELL ["/bin/bash", "-c"]' Dockerfile.${CNAME}
# build the Docker image
rm -f docker_build.log
sudo docker image build -f Dockerfile.${CNAME} -t jedi-${CNAME}:${TAG} context 2>&1 | tee docker_build.log
echo "=============================================================="
echo " Building Singularity Image"
echo "=============================================================="
rm -f singularity_build.log
sudo singularity build containers/jedi-${CNAME}_${TAG}.sif docker-daemon:jedi-${CNAME}:${TAG} 2>&1 | tee singularity_build.log
singularity sign containers/jedi-${CNAME}_${TAG}.sif