-
Notifications
You must be signed in to change notification settings - Fork 183
/
build-all-dockerfiles.sh
executable file
·51 lines (48 loc) · 1.2 KB
/
build-all-dockerfiles.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
#!/bin/bash -e
# Parse command line arguments.
prune=false
push=false
cpu_shares=0
cpu_quota=-1
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--prune)
prune=true
shift
;;
--push)
push=true
shift
;;
--cpu-shares)
cpu_shares="$2"
shift
shift
;;
--cpu-quota)
cpu_quota="$2"
shift
shift
;;
*)
echo "Unknown option $key"
exit 1
;;
esac
done
# Read the project version.
PROJECT_VERSION="$(cat ./tensorflow_cc/PROJECT_VERSION)"
for tag in ubuntu ubuntu-cuda archlinux archlinux-cuda; do
docker build --cpu-shares="${cpu_shares}" --cpu-quota="${cpu_quota}" --pull -t floopcz/tensorflow_cc:${tag} -f Dockerfiles/${tag} .
docker tag floopcz/tensorflow_cc:${tag} floopcz/tensorflow_cc:${tag}-"${PROJECT_VERSION}"
if $push; then
docker push floopcz/tensorflow_cc:${tag}
docker push floopcz/tensorflow_cc:${tag}-"${PROJECT_VERSION}"
fi
if $prune; then
docker rmi floopcz/tensorflow_cc:${tag}
docker rmi floopcz/tensorflow_cc:${tag}-"${PROJECT_VERSION}"
docker system prune -af
fi
done