2023-09-25 23:52:05 -07:00
|
|
|
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
|
2023-09-22 11:57:31 -07:00
|
|
|
|
|
|
|
ARG TARGETARCH
|
2023-09-30 13:34:01 -07:00
|
|
|
ARG GOFLAGS="'-ldflags=-w -s'"
|
2023-09-08 13:41:49 -07:00
|
|
|
|
2023-07-03 18:56:17 -04:00
|
|
|
WORKDIR /go/src/github.com/jmorganca/ollama
|
2023-09-22 11:57:31 -07:00
|
|
|
RUN apt-get update && apt-get install -y git build-essential cmake
|
2023-10-12 23:23:12 -04: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 14:14:20 -07:00
|
|
|
|
2023-07-03 18:56:17 -04:00
|
|
|
COPY . .
|
2023-09-22 11:57:31 -07:00
|
|
|
ENV GOARCH=$TARGETARCH
|
2023-10-03 07:05:09 -07:00
|
|
|
ENV GOFLAGS=$GOFLAGS
|
2023-09-22 11:57:31 -07:00
|
|
|
RUN /usr/local/go/bin/go generate ./... \
|
2023-09-26 10:38:32 -07:00
|
|
|
&& /usr/local/go/bin/go build .
|
2023-07-03 18:56:17 -04:00
|
|
|
|
2023-09-22 11:57:31 -07:00
|
|
|
FROM ubuntu:22.04
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates
|
2023-09-06 14:14:20 -07:00
|
|
|
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama
|
2023-09-30 12:32:06 -07:00
|
|
|
EXPOSE 11434
|
|
|
|
ENV OLLAMA_HOST 0.0.0.0
|
2023-11-30 21:16:56 -08: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 18:56:17 -04:00
|
|
|
ENTRYPOINT ["/bin/ollama"]
|
2023-07-06 16:34:14 -04:00
|
|
|
CMD ["serve"]
|