2023-09-06 21:14:20 +00:00
|
|
|
FROM golang:alpine
|
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
WORKDIR /go/src/github.com/jmorganca/ollama
|
2023-09-06 21:14:20 +00:00
|
|
|
RUN apk add --no-cache git build-base cmake
|
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
COPY . .
|
2023-09-06 21:14:20 +00:00
|
|
|
RUN go generate ./... && go build -ldflags '-linkmode external -extldflags "-static"' .
|
2023-07-03 22:56:17 +00:00
|
|
|
|
|
|
|
FROM alpine
|
2023-09-06 21:14:20 +00:00
|
|
|
ENV OLLAMA_HOST 0.0.0.0
|
|
|
|
RUN apk add --no-cache libstdc++
|
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
ARG USER=ollama
|
|
|
|
ARG GROUP=ollama
|
2023-09-06 21:14:20 +00:00
|
|
|
RUN addgroup $GROUP && adduser -D -G $GROUP $USER
|
|
|
|
|
|
|
|
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama
|
|
|
|
|
2023-07-03 22:56:17 +00:00
|
|
|
USER $USER:$GROUP
|
|
|
|
ENTRYPOINT ["/bin/ollama"]
|
2023-07-06 20:34:14 +00:00
|
|
|
CMD ["serve"]
|