2023-09-26 06:52:05 +00:00
|
|
|
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
|
2023-09-22 18:57:31 +00:00
|
|
|
|
|
|
|
ARG TARGETARCH
|
2023-09-30 20:34:01 +00:00
|
|
|
ARG GOFLAGS="'-ldflags=-w -s'"
|
2023-09-08 20:41:49 +00:00
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
WORKDIR /go/src/github.com/jmorganca/ollama
|
2023-09-22 18:57:31 +00:00
|
|
|
RUN apt-get update && apt-get install -y git build-essential cmake
|
2023-10-13 03:23:12 +00:00
|
|
|
ADD https://dl.google.com/go/go1.21.3.linux-$TARGETARCH.tar.gz /tmp/go1.21.3.tar.gz
|
|
|
|
RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.3.tar.gz
|
2023-09-06 21:14:20 +00:00
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
COPY . .
|
2023-09-22 18:57:31 +00:00
|
|
|
ENV GOARCH=$TARGETARCH
|
2023-10-03 14:05:09 +00:00
|
|
|
ENV GOFLAGS=$GOFLAGS
|
2023-09-22 18:57:31 +00:00
|
|
|
RUN /usr/local/go/bin/go generate ./... \
|
2023-09-26 17:38:32 +00:00
|
|
|
&& /usr/local/go/bin/go build .
|
2023-07-03 22:56:17 +00:00
|
|
|
|
2023-09-22 18:57:31 +00:00
|
|
|
FROM ubuntu:22.04
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates
|
2023-09-06 21:14:20 +00:00
|
|
|
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama
|
2023-09-30 19:32:06 +00:00
|
|
|
EXPOSE 11434
|
|
|
|
ENV OLLAMA_HOST 0.0.0.0
|
2023-12-01 05:16:56 +00:00
|
|
|
|
|
|
|
# set some environment variable for better NVIDIA compatibility
|
|
|
|
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64
|
|
|
|
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
ENTRYPOINT ["/bin/ollama"]
|
2023-07-06 20:34:14 +00:00
|
|
|
CMD ["serve"]
|