ollama/Dockerfile

25 lines
622 B
Text
Raw Normal View History

2023-09-06 14:14:20 -07:00
FROM golang:alpine
2023-09-08 13:41:49 -07:00
ARG VERSION=0.0.0
2023-07-03 18:56:17 -04:00
WORKDIR /go/src/github.com/jmorganca/ollama
2023-09-06 14:14:20 -07:00
RUN apk add --no-cache git build-base cmake
2023-07-03 18:56:17 -04:00
COPY . .
2023-09-08 13:41:49 -07:00
RUN go generate ./... \
&& go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" .
2023-07-03 18:56:17 -04:00
FROM alpine
2023-09-06 14:14:20 -07:00
ENV OLLAMA_HOST 0.0.0.0
RUN apk add --no-cache libstdc++
2023-07-03 18:56:17 -04:00
ARG USER=ollama
ARG GROUP=ollama
2023-09-06 14:14:20 -07:00
RUN addgroup $GROUP && adduser -D -G $GROUP $USER
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama
2023-07-03 18:56:17 -04:00
USER $USER:$GROUP
ENTRYPOINT ["/bin/ollama"]
2023-07-06 16:34:14 -04:00
CMD ["serve"]