From 1d9e4192b48e57d78ecdb9f711ddf1547a3eb229 Mon Sep 17 00:00:00 2001 From: Shang Chieh Tseng Date: Fri, 11 Apr 2025 15:25:33 +0800 Subject: [PATCH] Add ollama37 image, build from source --- ollama37/Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ollama37/Dockerfile diff --git a/ollama37/Dockerfile b/ollama37/Dockerfile new file mode 100644 index 0000000..6ef15fd --- /dev/null +++ b/ollama37/Dockerfile @@ -0,0 +1,28 @@ +# ===== Stage 1: Build the source code ===== +FROM dogkeeper886/ollama37-builder AS builder + +# Copy source code and build +RUN cd /usr/local/src \ + && git clone https://github.com/dogkeeper886/ollama37 \ + && cd ollama37 \ + && CC=/usr/local/bin/gcc CXX=/usr/local/g++ cmake -B build \ + && CC=/usr/local/bin/gcc CXX=/usr/local/g++ cmake --build build \ + && go build -o ollama . + +# ===== Stage 2: Runtime image ===== +FROM rockylinux/rockylinux:9 + +# Copy only the built binary and any needed assets from the builder stage +COPY --from=builder /usr/local/src/ollama37 /usr/local/src/ollama37 + +# Set environment variables +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility +ENV NVIDIA_VISIBLE_DEVICES=all +ENV OLLAMA_HOST=0.0.0.0:11434 + +# Expose port +EXPOSE 11434 + +# Set entrypoint and command +ENTRYPOINT ["/usr/local/src/ollama37/ollama"] +CMD ["serve"]