diff --git a/.docker/build b/.docker/build index d3295ddb..b029dce7 100755 --- a/.docker/build +++ b/.docker/build @@ -77,6 +77,21 @@ build_arm() { fi } +build_nvidia() { + if [ "$1" = "base" ] + then + # build nvidia base + docker build -t "${BUILD_IMAGE}:nvidia-base" -f base/Dockerfile.nvidia "${BASE}" + elif [ -f "$1/Dockerfile.nvidia" ] + then + # build dedicated nvidia image + docker build -t "${BUILD_IMAGE}:nvidia-$1" --build-arg="BASE_IMAGE=${BUILD_IMAGE}:nvidia-base" -f "$1/Dockerfile.nvidia" "$1/" + else + # try to build nvidia image with common Dockerfile + docker build -t "${BUILD_IMAGE}:nvidia-$1" --build-arg="BASE_IMAGE=${BUILD_IMAGE}:nvidia-base" -f "$1/Dockerfile" "$1/" + fi +} + case $1 in client) build_client;; server) build_server;; @@ -84,6 +99,9 @@ case $1 in # build arm- images arm-*) build_arm "${1#arm-}";; + # build nvidia- images + nvidia-*) build_nvidia "${1#nvidia-}";; + # build images *) build "$1";; esac diff --git a/.docker/start-server b/.docker/start-server index 7613dc8f..560b4ce8 100755 --- a/.docker/start-server +++ b/.docker/start-server @@ -17,6 +17,7 @@ if [ ! -f "${BINARY_PATH}" ] || [ "$1" == "-r" ]; then ./rebuild-server fi +# use --gpus all to enable GPU acceleration docker run --rm -it \ --name "neko_dev" \ -p "${SERVER_PORT}:8080" \