diff --git a/docker/base/build.sh b/docker/base/build.sh index a4191b05..1b5c72d3 100755 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -1,16 +1,16 @@ cp /etc/apt/trusted.gpg.d/jetson-ota-public.asc ../.. # copy to jetbot root -if [[ "$L4T_VERSION" == "32.4.3" ]] -then - BASE_IMAGE=nvcr.io/nvidia/l4t-pytorch:r32.4.3-pth1.6-py3 -elif [[ "$L4T_VERSION" == "32.4.4" ]] -then - BASE_IMAGE=nvcr.io/nvidia/l4t-pytorch:r32.4.4-pth1.6-py3 -fi +BASE_IMAGE=$1 + +echo "sudo docker build \ + --build-arg BASE_IMAGE=$BASE_IMAGE \ + -t jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -f Dockerfile \ + ../.." # jetbot repo root as context sudo docker build \ --build-arg BASE_IMAGE=$BASE_IMAGE \ - -t $JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile \ ../.. # jetbot repo root as context diff --git a/docker/build.sh b/docker/build.sh index cf7dae1e..fa6a32de 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,4 +1,22 @@ -cd base && ./build.sh && cd .. +BASE_IMAGE=$1 + +# find L4T_VERSION +source ../scripts/l4t-version.sh + +if [ -z $BASE_IMAGE ]; then + if [ $L4T_VERSION = "32.4.4" ]; then + BASE_IMAGE="nvcr.io/nvidia/l4t-pytorch:r32.4.4-pth1.6-py3" + else + echo "cannot build jetbot docker containers for L4T R$L4T_VERSION" + echo "please upgrade to the latest JetPack, or build jetson-inference natively" + exit 1 + fi +fi + +echo "cd base && ./build.sh $BASE_IMAGE && cd .." +cd base && ./build.sh $BASE_IMAGE && cd .. + +echo "cd models && ./build.sh && cd .." cd models && ./build.sh && cd .. cd display && ./build.sh && cd .. cd jupyter && ./build.sh && cd .. diff --git a/docker/camera/build.sh b/docker/camera/build.sh index 461f1e22..192476e2 100755 --- a/docker/camera/build.sh +++ b/docker/camera/build.sh @@ -1,4 +1,4 @@ sudo docker build \ - --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ - -t $JETBOT_DOCKER_REMOTE/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t jetbot/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/camera/enable.sh b/docker/camera/enable.sh index 66e60486..27a786c7 100755 --- a/docker/camera/enable.sh +++ b/docker/camera/enable.sh @@ -10,4 +10,4 @@ sudo docker run -it -d \ --volume /tmp/argus_socket:/tmp/argus_socket \ --privileged \ --name=jetbot_camera \ - $JETBOT_DOCKER_REMOTE/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION + jetbot/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION diff --git a/docker/configure.sh b/docker/configure.sh index f8e2a79a..ce8eb8c6 100755 --- a/docker/configure.sh +++ b/docker/configure.sh @@ -1,21 +1,14 @@ #!/bin/bash export JETBOT_VERSION=0.4.2 +echo "export JETBOT_VERSION=$JETBOT_VERSION" L4T_VERSION_STRING=$(head -n 1 /etc/nv_tegra_release) L4T_RELEASE=$(echo $L4T_VERSION_STRING | cut -f 2 -d ' ' | grep -Po '(?<=R)[^;]+') L4T_REVISION=$(echo $L4T_VERSION_STRING | cut -f 2 -d ',' | grep -Po '(?<=REVISION: )[^;]+') export L4T_VERSION="$L4T_RELEASE.$L4T_REVISION" - -if [[ "$L4T_VERSION" == "32.4.3" ]] -then - # docker hub - export JETBOT_DOCKER_REMOTE=jetbot -elif [[ "$L4T_VERSION" == "32.4.4" ]] -then - export JETBOT_DOCKER_REMOTE=jetbot -fi +echo "export L4T_VERSION=$L4T_RELEASE.$L4T_REVISION" ./set_nvidia_runtime.sh sudo systemctl enable docker @@ -25,6 +18,8 @@ SYSTEM_RAM_KILOBYTES=$(awk '/^MemTotal:/{print $2}' /proc/meminfo) if [ $SYSTEM_RAM_KILOBYTES -gt 3000000 ] then + echo "export JETBOT_JUPYTER_MEMORY=500m" + echo "export JETBOT_JUPYTER_MEMORY_SWAP=3G" export JETBOT_JUPYTER_MEMORY=500m export JETBOT_JUPYTER_MEMORY_SWAP=3G fi diff --git a/docker/display/build.sh b/docker/display/build.sh index 862f005f..8e55e7b5 100755 --- a/docker/display/build.sh +++ b/docker/display/build.sh @@ -1,5 +1,5 @@ sudo docker build \ - --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ - -t $JETBOT_DOCKER_REMOTE/jetbot:display-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t jetbot/jetbot:display-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/display/enable.sh b/docker/display/enable.sh index d0c68e6f..7a279a05 100755 --- a/docker/display/enable.sh +++ b/docker/display/enable.sh @@ -4,4 +4,4 @@ sudo docker run -it -d \ --network host \ --privileged \ --name=jetbot_display \ - $JETBOT_DOCKER_REMOTE/jetbot:display-$JETBOT_VERSION-$L4T_VERSION + jetbot/jetbot:display-$JETBOT_VERSION-$L4T_VERSION diff --git a/docker/jupyter/build.sh b/docker/jupyter/build.sh index ffebcabe..cccaee0a 100755 --- a/docker/jupyter/build.sh +++ b/docker/jupyter/build.sh @@ -1,4 +1,4 @@ sudo docker build \ - --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ - -t $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=jetbot/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ + -t jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/jupyter/enable.sh b/docker/jupyter/enable.sh index 31249d0d..33daef2b 100755 --- a/docker/jupyter/enable.sh +++ b/docker/jupyter/enable.sh @@ -24,7 +24,7 @@ then --name=jetbot_jupyter \ --memory-swap=$JETBOT_JUPYTER_MEMORY_SWAP \ --env JETBOT_DEFAULT_CAMERA=$JETBOT_CAMERA \ - $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION + jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION else @@ -43,6 +43,6 @@ else --memory=$JETBOT_JUPYTER_MEMORY \ --memory-swap=$JETBOT_JUPYTER_MEMORY_SWAP \ --env JETBOT_DEFAULT_CAMERA=$JETBOT_CAMERA \ - $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION + jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION fi diff --git a/docker/models/build.sh b/docker/models/build.sh index 740c14b1..b1e54d5c 100755 --- a/docker/models/build.sh +++ b/docker/models/build.sh @@ -1,4 +1,9 @@ +echo "sudo docker build \ + --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t jetbot/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ + -f Dockerfile ." + sudo docker build \ - --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ - -t $JETBOT_DOCKER_REMOTE/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t jetbot/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/push.sh b/docker/push.sh index b8666a99..ce61fd01 100755 --- a/docker/push.sh +++ b/docker/push.sh @@ -1,5 +1,5 @@ #!/bin/bash -sudo docker push $JETBOT_DOCKER_REMOTE/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION -sudo docker push $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION -sudo docker push $JETBOT_DOCKER_REMOTE/jetbot:display-$JETBOT_VERSION-$L4T_VERSION +sudo docker push jetbot/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION +sudo docker push jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION +sudo docker push jetbot/jetbot:display-$JETBOT_VERSION-$L4T_VERSION diff --git a/scripts/l4t-version.sh b/scripts/l4t-version.sh new file mode 100755 index 00000000..60d75d67 --- /dev/null +++ b/scripts/l4t-version.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# + +L4T_VERSION_STRING=$(head -n 1 /etc/nv_tegra_release) + +if [ -z "$L4T_VERSION_STRING" ]; then + echo "reading L4T version from \"dpkg-query --show nvidia-l4t-core\"" + + L4T_VERSION_STRING=$(dpkg-query --showformat='${Version}' --show nvidia-l4t-core) + L4T_VERSION_ARRAY=(${L4T_VERSION_STRING//./ }) + + #echo ${L4T_VERSION_ARRAY[@]} + #echo ${#L4T_VERSION_ARRAY[@]} + + L4T_RELEASE=${L4T_VERSION_ARRAY[0]} + L4T_REVISION=${L4T_VERSION_ARRAY[1]} +else + echo "reading L4T version from /etc/nv_tegra_release" + + L4T_RELEASE=$(echo $L4T_VERSION_STRING | cut -f 2 -d ' ' | grep -Po '(?<=R)[^;]+') + L4T_REVISION=$(echo $L4T_VERSION_STRING | cut -f 2 -d ',' | grep -Po '(?<=REVISION: )[^;]+') +fi + +L4T_REVISION_MAJOR=${L4T_REVISION:0:1} +L4T_REVISION_MINOR=${L4T_REVISION:2:1} + +L4T_VERSION="$L4T_RELEASE.$L4T_REVISION" + +echo "L4T BSP Version: L4T R$L4T_VERSION"