2024-07-07 21:49:35 +05:30
|
|
|
FROM golang:1.22-alpine as build
|
2023-09-22 11:57:31 -07:00
|
|
|
|
2024-07-07 21:49:35 +05:30
|
|
|
RUN apk add cmake build-base bash git
|
2023-09-08 13:41:49 -07:00
|
|
|
|
2024-07-01 16:44:31 +05:30
|
|
|
WORKDIR /app
|
2024-01-21 11:37:11 -08:00
|
|
|
|
2024-07-01 16:44:31 +05:30
|
|
|
ADD . .
|
2024-01-21 11:37:11 -08:00
|
|
|
|
2024-07-07 21:49:35 +05:30
|
|
|
ARG GIN_MODE=release
|
|
|
|
|
|
|
|
RUN OLLAMA_CUSTOM_CPU_DEFS="-DLLAMA_NATIVE=ON" go generate ./... && \
|
2024-07-01 16:44:31 +05:30
|
|
|
go build -ldflags="-s -w"
|
2024-01-21 11:37:11 -08:00
|
|
|
|
2024-07-07 21:49:35 +05:30
|
|
|
FROM alpine:latest
|
2024-01-21 11:37:11 -08:00
|
|
|
|
2024-07-07 21:49:35 +05:30
|
|
|
RUN apk add libstdc++ libgomp supervisor
|
2024-01-21 12:57:13 -08:00
|
|
|
|
2024-07-07 21:49:35 +05:30
|
|
|
WORKDIR /ollama
|
2024-01-21 11:37:11 -08:00
|
|
|
|
2024-07-01 16:44:31 +05:30
|
|
|
COPY --from=build /app/ollama /ollama
|
2024-07-01 18:14:10 +05:30
|
|
|
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 21:49:35 +05:30
|
|
|
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 11:37:11 -08:00
|
|
|
|
2024-07-01 16:44:31 +05:30
|
|
|
ENV MODEL_NAME="llama"
|
|
|
|
ENV OLLAMA_HOST="0.0.0.0:8080"
|
2024-03-14 10:24:13 -07:00
|
|
|
|
2024-07-01 16:44:31 +05:30
|
|
|
EXPOSE 8080
|
2023-09-06 14:14:20 -07:00
|
|
|
|
2024-07-07 21:49:35 +05:30
|
|
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|