From 1fc04c2c49f185ff1195b9b4e38b5b8abc324fa4 Mon Sep 17 00:00:00 2001 From: Mathieu Strypsteen Date: Tue, 26 Nov 2024 09:04:59 +0100 Subject: [PATCH] Add gpu to ollama --- containers/code-server/Containerfile | 2 +- gpu/etc/containers/systemd/ollama.container | 4 ++++ gpu/etc/containers/systemd/ollama.volume | 0 gpu/var/lib/systemd/linger/root | 0 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 gpu/etc/containers/systemd/ollama.volume create mode 100644 gpu/var/lib/systemd/linger/root diff --git a/containers/code-server/Containerfile b/containers/code-server/Containerfile index 2ab6643..70e2c87 100644 --- a/containers/code-server/Containerfile +++ b/containers/code-server/Containerfile @@ -1,7 +1,7 @@ FROM quay.io/fedora/fedora-toolbox:41 RUN dnf up -y RUN dnf install -y bash-color-prompt clang clang-tools-extra gcc hyperfine java-devel llvm mtools nodejs-npm openssl-devel parted poetry postgresql-server python3-pip qemu-system-x86-core rustup systemd-container vim-enhanced -RUN dnf install -y https://github.com/coder/code-server/releases/download/v4.95.2/code-server-4.95.2-amd64.rpm +RUN dnf install -y https://github.com/coder/code-server/releases/download/v4.95.3/code-server-4.95.3-amd64.rpm RUN mkdir /etc/systemd/system/user@.service.d RUN mkdir /var/lib/systemd/linger RUN touch /var/lib/systemd/linger/coder diff --git a/gpu/etc/containers/systemd/ollama.container b/gpu/etc/containers/systemd/ollama.container index ef1a930..6a53332 100644 --- a/gpu/etc/containers/systemd/ollama.container +++ b/gpu/etc/containers/systemd/ollama.container @@ -1,5 +1,9 @@ [Container] Image=docker.io/ollama/ollama +AddDevice=nvidia.com/gpu=all +Volume=ollama.volume:/root/.ollama/models:U,Z +Environment=OLLAMA_NOHISTORY=true +PublishPort=11434:11434 AutoUpdate=registry [Install] WantedBy=multi-user.target diff --git a/gpu/etc/containers/systemd/ollama.volume b/gpu/etc/containers/systemd/ollama.volume new file mode 100644 index 0000000..e69de29 diff --git a/gpu/var/lib/systemd/linger/root b/gpu/var/lib/systemd/linger/root new file mode 100644 index 0000000..e69de29