2023-09-12 15:04:35 +00:00
|
|
|
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
|
|
|
|
|
2023-09-08 20:41:49 +00:00
|
|
|
ARG TARGETARCH
|
|
|
|
ARG VERSION=0.0.0
|
|
|
|
|
2023-09-12 15:04:35 +00:00
|
|
|
WORKDIR /go/src/github.com/jmorganca/ollama
|
|
|
|
RUN apt-get update && apt-get install -y git build-essential cmake
|
2023-09-08 20:41:49 +00:00
|
|
|
ADD https://dl.google.com/go/go1.21.1.linux-$TARGETARCH.tar.gz /tmp/go1.21.1.tar.gz
|
2023-09-12 15:04:35 +00:00
|
|
|
RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.tar.gz
|
|
|
|
|
|
|
|
COPY . .
|
2023-09-08 20:41:49 +00:00
|
|
|
ENV GOARCH=$TARGETARCH
|
|
|
|
RUN /usr/local/go/bin/go generate ./... \
|
|
|
|
&& /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" .
|
2023-09-12 15:04:35 +00:00
|
|
|
|
|
|
|
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04
|
|
|
|
ENV OLLAMA_HOST 0.0.0.0
|
|
|
|
|
|
|
|
ARG USER=ollama
|
|
|
|
ARG GROUP=ollama
|
|
|
|
RUN groupadd $GROUP && useradd -m -g $GROUP $USER
|
|
|
|
|
|
|
|
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama
|
|
|
|
|
|
|
|
USER $USER:$GROUP
|
|
|
|
ENTRYPOINT ["/bin/ollama"]
|
|
|
|
CMD ["serve"]
|