From 8cdea811929f6c7dc69a4e00cb9adf40a7797a66 Mon Sep 17 00:00:00 2001 From: Luxadevi <116653852+Luxadevi@users.noreply.github.com> Date: Sun, 14 Jan 2024 04:39:15 +0000 Subject: [PATCH] Create Dockerfile Buildfile docker container for ollama-companion standalone --- container/companion/Dockerfile | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 container/companion/Dockerfile diff --git a/container/companion/Dockerfile b/container/companion/Dockerfile new file mode 100644 index 0000000..d995f90 --- /dev/null +++ b/container/companion/Dockerfile @@ -0,0 +1,44 @@ +# First Stage - Building the Go application +FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as builder + +ARG TARGETARCH +ARG GOFLAGS="'-ldflags=-w -s'" + +WORKDIR /go/src/github.com/jmorganca/ollama + +RUN apt-get update && apt-get install -y git build-essential cmake + + +RUN git clone https://github.com/ggerganov/llama.cpp.git && \ + mkdir llama.cpp/build && \ + cd llama.cpp/build && \ + cmake .. && \ + cmake --build . --config Release + +# Second Stage - Setting up Python environment and runtime +FROM ubuntu:22.04 + +# Install Python 3.11, venv, and other necessary packages +RUN apt-get update && apt-get install -y curl aria2 ca-certificates python3.11 python3.11-venv git + +# Clone the Python application repository +WORKDIR /ollama-companion +RUN git clone https://github.com/luxadevi/ollama-companion.git . +RUN git clone https://github.com/ggerganov/llama.cpp.git +# Set up Python virtual environment and install dependencies +RUN python3.11 -m venv venv +RUN /bin/bash -c "source venv/bin/activate && venv/bin/pip install -r requirements.txt" + + +# Copy the run.sh script and make it executable +COPY run.sh /run.sh +RUN chmod +x /run.sh + +COPY --from=builder /go/src/github.com/jmorganca/ollama/llama.cpp/build/bin /ollama-companion/llama.cpp + + +EXPOSE 8501 +ENV OLLAMA_HOST 0.0.0.0 + +## Set the entry point to run.sh +ENTRYPOINT ["/run.sh"]