-
Notifications
You must be signed in to change notification settings - Fork 16
/
Containerfile.build
51 lines (37 loc) · 1.28 KB
/
Containerfile.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM docker.io/nvidia/cuda:12.6.2-devel-ubi9
ARG OLLAMA_VERSION
ARG GOLANG_VERSION=1.22.1
ARG CMAKE_VERSION=3.22.1
ENV VERSION ${OLLAMA_VERSION}
RUN dnf -y update \
&& dnf install -y --nodocs pciutils git
# The cmake and golang dependencies require special logic
COPY ./scripts/rh_linux_deps.sh /
RUN CMAKE_VERSION=${CMAKE_VERSION} GOLANG_VERSION=${GOLANG_VERSION} sh /rh_linux_deps.sh
RUN dnf clean all && rm -rf /var/cache/* \
&& git clone --depth 1 --branch $VERSION https://github.com/ollama/ollama.git
#USER root
WORKDIR /ollama
RUN go generate ./... \
&& go build . \
&& ls -l /ollama
# RUNTIME CONTAINER
FROM docker.io/nvidia/cuda:12.6.2-runtime-ubi9
ARG OLLAMA_VERSION
RUN dnf -y update \
&& dnf install -y --nodocs pciutils \
&& dnf clean all && rm -rf /var/cache/*
COPY --from=0 /ollama/ollama /usr/local/bin/ollama
COPY VERSION /OLLAMA_VERSION
LABEL [email protected] \
io.k8s.display-name="Ollama AI" \
summary="ollama.ai - tool for running LLMs locally"
#ENV PYTHONDONTWRITEBYTECODE 1
#ENV PYTHONUNBUFFERED 1
EXPOSE 11434
ENV OLLAMA_HOST 0.0.0.0
ENV OLLAMA_VERSION ${OLLAMA_VERSION}-ubi9
#ENV OLLAMA_ORIGINS http://localhost:*,http://0.0.0.0:*
ENV OLLAMA_MODELS /.ollama/models
ENTRYPOINT ["/usr/local/bin/ollama"]
CMD ["serve"]