Archived
2
0

add nvidia docker to build.

This commit is contained in:
Miroslav Šedivý 2023-01-14 23:35:52 +01:00
parent 83b0110d66
commit 8026360669
2 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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" \