From 22dc23ed45863e317e51f00ba67f16c5987df299 Mon Sep 17 00:00:00 2001 From: Nick Petrovic <4001122+nickpetrovic@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:44:23 -0500 Subject: [PATCH] Build GPU docker image on linux if nvidia-smi exists (#61) --- Makefile | 2 +- bin/k3d.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7b6c5fc27..e8277c10f 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ beam-worker: bin/delete_workers.sh beam-runner: - for target in py312 py311 py310 py39 py38; do \ + for target in py311 py310 py39 py38; do \ docker build . --target $$target --platform=linux/amd64 -f ./docker/Dockerfile.runner -t localhost:5001/beam-runner:$$target-$(runnerTag); \ docker push localhost:5001/beam-runner:$$target-$(runnerTag); \ done diff --git a/bin/k3d.sh b/bin/k3d.sh index e19ec6b45..6aeb92914 100644 --- a/bin/k3d.sh +++ b/bin/k3d.sh @@ -16,8 +16,12 @@ k3d_up() { os_type="$(uname)" case "$os_type" in Linux*) - check_gpu_linux && extra_args="--gpus=all --image=localhost:5001/rancher/k3s:latest" || extra_args="" - docker build . -f ./docker/Dockerfile.k3d -t localhost:5001/rancher/k3s:latest + if check_gpu_linux; then + extra_args="--gpus=all --image=localhost:5001/rancher/k3s:latest" + docker build . -f ./docker/Dockerfile.k3d -t localhost:5001/rancher/k3s:latest + else + extra_args="" + fi ;; Darwin*) extra_args=""