From 1fa71c26701ec5a96901c179fd822bab8ed64d04 Mon Sep 17 00:00:00 2001 From: Shang Chieh Tseng Date: Sat, 19 Jul 2025 21:53:33 +0800 Subject: [PATCH] docker: optimize binary copy in Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copy only the ollama binary instead of entire source directory to reduce image size and remove unnecessary symbolic link step. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- ollama37.Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ollama37.Dockerfile b/ollama37.Dockerfile index 418ed42e..2f0a8e6a 100644 --- a/ollama37.Dockerfile +++ b/ollama37.Dockerfile @@ -15,13 +15,10 @@ FROM rockylinux/rockylinux:8 RUN dnf -y update # Copy only the built binary and any needed assets from the builder stage -COPY --from=builder /usr/local/src/ollama37 /usr/local/src/ollama37 +COPY --from=builder /usr/local/src/ollama37/ollama /usr/local/bin/ollama COPY --from=builder /usr/local/lib64 /usr/local/lib64 COPY --from=builder /usr/local/cuda-11.4/lib64 /usr/local/cuda-11.4/lib64 -# Create a symbolic link from the built binary to /usr/local/bin for easy access -RUN ln -s /usr/local/src/ollama37/ollama /usr/local/bin/ollama - # Set environment variables ENV LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/cuda-11.4/lib64" ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility