-
Notifications
You must be signed in to change notification settings - Fork 52
/
build.sh
executable file
·69 lines (59 loc) · 1.82 KB
/
build.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
#!/bin/bash
trap ctrl_c INT
function ctrl_c() {
echo "Requested to stop."
exit 1
}
set -e
PREFIX="awsdeepracercommunity"
ARCH="cpu gpu"
while getopts ":a:fp:" opt; do
case $opt in
a)
ARCH="$OPTARG"
;;
p)
PREFIX="$OPTARG"
;;
f)
OPT_NOCACHE="--no-cache"
;;
\?)
echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac
done
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
VERSION=$(cat $DIR/VERSION)
if [ "$(docker images -q ${PREFIX}/deepracer-simapp-build-core:latest 2> /dev/null)" == "" ] || [ -n "${OPT_NOCACHE}" ]; then
echo "Preparing core builder image ${PREFIX}/deepracer-simapp-build-core:latest..."
docker buildx build ${OPT_NOCACHE} -t ${PREFIX}/deepracer-simapp-build-core:latest -f docker/Dockerfile.build-core .
else
echo "Core builder image ${PREFIX}/deepracer-simapp-build-core:latest already exists."
fi
echo "Preparing bundle distribution..."
docker buildx build ${OPT_NOCACHE} -t ${PREFIX}/deepracer-simapp-build-bundle:latest -f docker/Dockerfile.build-bundle --build-arg BUILDER_PREFIX=${PREFIX} .
echo "Preparing docker images for [$ARCH]"
for a in $ARCH; do
case $a in
gpu)
CORE_IMG="nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04"
NVCC_VER="cuda-nvcc-11-8"
TF_VER="tensorflow==2.13.1"
;;
cpu)
CORE_IMG="ubuntu:20.04"
NVCC_VER=""
TF_VER="tensorflow-cpu==2.13.1"
;;
esac
set -x
docker buildx build . ${OPT_NOCACHE} -t $PREFIX/deepracer-simapp:${VERSION}-${a} -f docker/Dockerfile.combined \
--build-arg IMG_VERSION=${VERSION} \
--build-arg BUNDLE_PREFIX=${PREFIX} \
--build-arg CORE_IMG=${CORE_IMG} \
--build-arg NVCC_VER=${NVCC_VER} \
--build-arg TF_VER=${TF_VER}
set +x
done