-
Notifications
You must be signed in to change notification settings - Fork 935
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
usage() { | ||
cat << EOF | ||
Usage: $0 [OPTIONS] | ||
Build a new Python TPU 1VM Docker image. | ||
Options: | ||
-c, --use-cache Use layer cache when building a new image. | ||
EOF | ||
} | ||
|
||
CACHE_FLAG='--no-cache' | ||
TENSORFLOW_DOCKERFILE='tensorflow.Dockerfile' | ||
TENSORFLOW_IMAGE_TAG='kaggle/python-tpuvm-tensorflow-build' | ||
DOCKERFILE='Dockerfile' | ||
IMAGE_TAG='kaggle/python-tpuvm-build' | ||
BUILD_ARGS='' | ||
|
||
while :; do | ||
case "$1" in | ||
-h|--help) | ||
usage | ||
exit | ||
;; | ||
-c|--use-cache) | ||
CACHE_FLAG='' | ||
;; | ||
-?*) | ||
usage | ||
printf 'ERROR: Unknown option: %s\n' "$1" >&2 | ||
exit | ||
;; | ||
*) | ||
break | ||
esac | ||
|
||
shift | ||
done | ||
|
||
BUILD_ARGS+=" --build-arg GIT_COMMIT=$(git rev-parse HEAD)" | ||
BUILD_ARGS+=" --build-arg BUILD_DATE=$(date '+%Y%m%d-%H%M%S')" | ||
|
||
# Read build args from config.txt file. | ||
SRCDIR=$(dirname "${BASH_SOURCE[0]}") | ||
for l in `cat ${SRCDIR}/config.txt`; do | ||
BUILD_ARGS+=" --build-arg $l" | ||
done | ||
|
||
readonly CACHE_FLAG | ||
readonly TENSORFLOW_DOCKERFILE | ||
readonly TENSORFLOW_IMAGE_TAG | ||
readonly DOCKERFILE | ||
readonly IMAGE_TAG | ||
readonly BUILD_ARGS | ||
|
||
TENSORFLOW_DOCKERFILE_PATH="$SRCDIR/$TENSORFLOW_DOCKERFILE" | ||
DOCKERFILE_PATH="$SRCDIR/$DOCKERFILE" | ||
|
||
set -x | ||
docker build --rm --pull $CACHE_FLAG -t "$TENSORFLOW_IMAGE_TAG" -f "$TENSORFLOW_DOCKERFILE_PATH" $BUILD_ARGS . | ||
docker build --rm --pull $CACHE_FLAG -t "$IMAGE_TAG" -f "$DOCKERFILE_PATH" $BUILD_ARGS . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
BASE_IMAGE_TAG=v108 | ||
LIBTPU_IMAGE_TAG=libtpu_1.1.0_RC00 | ||
TENSORFLOW_WHL_IMAGE_TAG=local |