-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild_tgvqsm_.sh
executable file
·86 lines (60 loc) · 2.49 KB
/
build_tgvqsm_.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
set -e
imageName='tgvqsm'
buildDate=`date +%Y%m%d`
buildPlatform=`cat /proc/cpuinfo | grep 'vendor' | uniq | cut -d ' ' -f 2`
echo $buildPlatform
if [ "$buildPlatform" = "AuthenticAMD" ]; then
echo "detected amd"
export buildPlatform='amd'
model=`cat /proc/cpuinfo | grep 'model name' | uniq | cut -d ' ' -f 5`
fi
if [ "$buildPlatform" = "GenuineIntel" ]; then
echo "detected intel"
export buildPlatform='intel'
export model=`cat /proc/cpuinfo | grep 'model name' | uniq | cut -d ' ' -f 6 | cut -d '-' -f 2`
fi
imageName=${imageName}_${buildPlatform}_${model}
echo "building $imageName"
#exit 0
#install neurodocker
#pip3 install --no-cache-dir https://github.com/kaczmarj/neurodocker/tarball/master --user
#upgrade neurodocker
#pip install --no-cache-dir https://github.com/kaczmarj/neurodocker/tarball/master --upgrade
neurodocker generate docker \
--base=debian:stretch \
--pkg-manager apt \
--run="printf '#!/bin/bash\nls -la' > /usr/bin/ll" \
--run="chmod +x /usr/bin/ll" \
--copy globalMountPointList.txt /globalMountPointList.txt \
--run="mkdir \`cat /globalMountPointList.txt\`" \
--install apt_opts='--quiet' cmake git python-setuptools wget unzip python3 python-numpy python-nibabel cython \
--run="git clone https://github.com/liangfu/bet2.git" \
--workdir /bet2/build \
--run="cmake .. && make" \
--dcm2niix version=latest method=source \
--workdir /\
--run "wget http://www.neuroimaging.at/media/qsm/TGVQSM-plus.zip" \
--run "unzip /TGVQSM-plus.zip" \
--workdir /TGVQSM-master-011045626121baa8bfdd6633929974c732ae35e3 \
--run "sed -i 's/march=native/march=x86-64/g' setup.py && python setup.py install" \
--user=neuro \
--env DEPLOY_PATH=/usr/local/bin/:/bet2/:/opt/dcm2niix-latest/bin \
> Dockerfile.${imageName}
docker build -t ${imageName}:$buildDate -f Dockerfile.${imageName} .
#test:
docker run -it ${imageName}:$buildDate
#exit 0
docker tag ${imageName}:$buildDate caid/${imageName}:$buildDate
#docker login
docker push caid/${imageName}:$buildDate
docker tag ${imageName}:$buildDate caid/${imageName}:latest
docker push caid/${imageName}:latest
echo "BootStrap:docker" > Singularity.${imageName}
echo "From:caid/${imageName}" >> Singularity.${imageName}
#rm ${imageName}_${buildDate}.simg
sudo singularity build ${imageName}_${buildDate}.simg Singularity.${imageName}
source ../setupSwift.sh
swift upload singularityImages ${imageName}_${buildDate}.simg
git commit -am 'auto commit after build run'
git push