From 8026360669ce5f0d0d470adca83228cac8af4b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 14 Jan 2023 23:35:52 +0100 Subject: [PATCH] add nvidia docker to build. --- .docker/build | 18 ++++++++++++++++++ .docker/start-server | 1 + 2 files changed, 19 insertions(+) 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" \