Skip to content

Commit dccf7d4

Browse files
authored
Merge pull request #275 from FloopCZ/cpu-shares
Add support for cpu shares limit to dockerfile builds
2 parents 5994cbe + 85a37d7 commit dccf7d4

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

build-all-dockerfiles.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,32 @@
33
# Parse command line arguments.
44
prune=false
55
push=false
6-
for key in "$@"; do
6+
cpu_shares=0
7+
cpu_quota=-1
8+
while [[ $# -gt 0 ]]; do
9+
key="$1"
710
case $key in
811
--prune)
912
prune=true
13+
shift
1014
;;
1115
--push)
1216
push=true
17+
shift
18+
;;
19+
--cpu-shares)
20+
cpu_shares="$2"
21+
shift
22+
shift
23+
;;
24+
--cpu-quota)
25+
cpu_quota="$2"
26+
shift
27+
shift
28+
;;
29+
*)
30+
echo "Unknown option $key"
31+
exit 1
1332
;;
1433
esac
1534
done
@@ -18,7 +37,7 @@ done
1837
PROJECT_VERSION="$(cat ./tensorflow_cc/PROJECT_VERSION)"
1938

2039
for tag in ubuntu ubuntu-cuda archlinux archlinux-cuda; do
21-
docker build --pull -t floopcz/tensorflow_cc:${tag} -f Dockerfiles/${tag} .
40+
docker build --cpu-shares="${cpu_shares}" --cpu-quota="${cpu_quota}" --pull -t floopcz/tensorflow_cc:${tag} -f Dockerfiles/${tag} .
2241
docker tag floopcz/tensorflow_cc:${tag} floopcz/tensorflow_cc:${tag}-"${PROJECT_VERSION}"
2342
if $push; then
2443
docker push floopcz/tensorflow_cc:${tag}

0 commit comments

Comments
 (0)