From db2c4284830b335e0384d635066342954dc024df Mon Sep 17 00:00:00 2001 From: Georgi Ivanov Date: Mon, 29 Sep 2025 22:27:06 +0300 Subject: [PATCH] Make Dockerfile-ollama-local detect arch --- Dockerfile-ollama-local | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Dockerfile-ollama-local b/Dockerfile-ollama-local index 92a254fa1..3b8341023 100644 --- a/Dockerfile-ollama-local +++ b/Dockerfile-ollama-local @@ -24,17 +24,13 @@ FROM python:3.11-slim AS ollama_base RUN apt-get update && apt-get install -y \ curl # Detect architecture and download appropriate Ollama version -# ARG TARGETARCH can be set at build time with --build-arg TARGETARCH=arm64 or TARGETARCH=amd64 -ARG TARGETARCH=arm64 -RUN OLLAMA_ARCH="" && \ - if [ "$TARGETARCH" = "arm64" ]; then \ - echo "Building for ARM64 architecture." && \ - OLLAMA_ARCH="arm64"; \ - elif [ "$TARGETARCH" = "amd64" ]; then \ - echo "Building for AMD64 architecture." && \ - OLLAMA_ARCH="amd64"; \ +RUN OLLAMA_ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ + if [ "$OLLAMA_ARCH" = "arm64" ]; then \ + echo "Building for ARM64 architecture."; \ + elif [ "$OLLAMA_ARCH" = "amd64" ]; then \ + echo "Building for AMD64 architecture."; \ else \ - echo "Error: Unsupported architecture '$TARGETARCH'. Supported architectures are 'arm64' and 'amd64'." >&2 && \ + echo "Error: Unsupported architecture '$OLLAMA_ARCH'. Supported architectures are 'arm64' and 'amd64'." >&2 && \ exit 1; \ fi && \ curl -L "https://ollama.com/download/ollama-linux-${OLLAMA_ARCH}.tgz" -o ollama.tgz && \