2024-07-07 16:19:35 +00:00
|
|
|
FROM golang:1.22-alpine as build
|
2023-09-22 18:57:31 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
RUN apk add cmake build-base bash git
|
2023-09-08 20:41:49 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
WORKDIR /app
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
ADD . .
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
ARG GIN_MODE=release
|
|
|
|
|
|
|
|
RUN OLLAMA_CUSTOM_CPU_DEFS="-DLLAMA_NATIVE=ON" go generate ./... && \
|
2024-07-01 11:14:31 +00:00
|
|
|
go build -ldflags="-s -w"
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
FROM alpine:latest
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
RUN apk add libstdc++ libgomp supervisor
|
2024-01-21 20:57:13 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
WORKDIR /ollama
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
COPY --from=build /app/ollama /ollama
|
2024-07-01 12:44:10 +00:00
|
|
|
COPY --from=build /app/serve.sh /ollama/serve.sh
|
|
|
|
COPY --from=build /app/run_model.sh /ollama/run_model.sh
|
|
|
|
COPY --from=build /app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
2024-07-07 16:19:35 +00:00
|
|
|
COPY --from=build /app/llm/build/linux/x86_64/cpu/src/libllama.so /usr/lib
|
|
|
|
COPY --from=build /app/llm/build/linux/x86_64/cpu/ggml/src/libggml.so /usr/lib
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
ENV MODEL_NAME="llama"
|
|
|
|
ENV OLLAMA_HOST="0.0.0.0:8080"
|
2024-03-14 17:24:13 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
EXPOSE 8080
|
2023-09-06 21:14:20 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|