ollama/Dockerfile

24 lines
710 B
Text
Raw Normal View History

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
ADD https://dl.google.com/go/go1.21.1.linux-$TARGETARCH.tar.gz /tmp/go1.21.1.tar.gz
RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.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-07-03 22:56:17 +00:00
ENTRYPOINT ["/bin/ollama"]
2023-07-06 20:34:14 +00:00
CMD ["serve"]