32 lines
814 B
Docker
32 lines
814 B
Docker
FROM golang:1.22-alpine as build
|
|
|
|
RUN apk add cmake build-base bash git
|
|
|
|
WORKDIR /app
|
|
|
|
ADD . .
|
|
|
|
ARG GIN_MODE=release
|
|
|
|
RUN OLLAMA_CUSTOM_CPU_DEFS="-DLLAMA_NATIVE=ON" go generate ./... && \
|
|
go build -ldflags="-s -w"
|
|
|
|
FROM alpine:latest
|
|
|
|
RUN apk add libstdc++ libgomp supervisor
|
|
|
|
WORKDIR /ollama
|
|
|
|
COPY --from=build /app/ollama /ollama
|
|
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
|
|
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
|
|
|
|
ENV MODEL_NAME="llama"
|
|
ENV OLLAMA_HOST="0.0.0.0:8080"
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|