update dockerfile

This commit is contained in:
Michael Yang 2023-09-06 14:14:20 -07:00
parent 83c6be1666
commit 9795b43d93
2 changed files with 13 additions and 11 deletions

View file

@ -1,8 +1,4 @@
build
llama/build
.venv
.vscode .vscode
ollama ollama
app app
web llm/llama.cpp/ggml
.env

View file

@ -1,15 +1,21 @@
FROM golang:1.20 FROM golang:alpine
WORKDIR /go/src/github.com/jmorganca/ollama WORKDIR /go/src/github.com/jmorganca/ollama
RUN apk add --no-cache git build-base cmake
COPY . . COPY . .
RUN CGO_ENABLED=1 go build -ldflags '-linkmode external -extldflags "-static"' . RUN go generate ./... && go build -ldflags '-linkmode external -extldflags "-static"' .
FROM alpine FROM alpine
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama ENV OLLAMA_HOST 0.0.0.0
EXPOSE 11434 RUN apk add --no-cache libstdc++
ARG USER=ollama ARG USER=ollama
ARG GROUP=ollama ARG GROUP=ollama
RUN addgroup -g 1000 $GROUP && adduser -u 1000 -DG $GROUP $USER RUN addgroup $GROUP && adduser -D -G $GROUP $USER
COPY --from=0 /go/src/github.com/jmorganca/ollama/ollama /bin/ollama
USER $USER:$GROUP USER $USER:$GROUP
ENTRYPOINT ["/bin/ollama"] ENTRYPOINT ["/bin/ollama"]
ENV OLLAMA_HOST 0.0.0.0
CMD ["serve"] CMD ["serve"]