llama-server.Dockerfile 886 B

123456789101112131415161718192021222324252627282930313233
  1. ARG UBUNTU_VERSION=22.04
  2. FROM ubuntu:$UBUNTU_VERSION AS build
  3. RUN apt-get update && \
  4. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  5. WORKDIR /app
  6. COPY . .
  7. RUN cmake -S . -B build -DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DLLAMA_CURL=ON -DCMAKE_BUILD_TYPE=Release && \
  8. cmake --build build -j $(nproc) && \
  9. mkdir -p /app/lib && \
  10. find build -name "*.so" -exec cp {} /app/lib/ \;
  11. FROM ubuntu:$UBUNTU_VERSION AS runtime
  12. WORKDIR /app
  13. RUN apt-get update && \
  14. apt-get install -y libcurl4-openssl-dev libgomp1 curl
  15. COPY --from=build /app/build/bin/llama-server /app/
  16. COPY --from=build /app/lib/ /app/
  17. ENV LC_ALL=C.utf8
  18. # Must be set to 0.0.0.0 so it can listen to requests from host machine
  19. ENV LLAMA_ARG_HOST=0.0.0.0
  20. HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
  21. ENTRYPOINT [ "/app/llama-server" ]