feat: make images to build sources on start (#124)

Signed-off-by: mudler <mudler@mocaccino.org>
swagger
Ettore Di Giacinto 2 years ago committed by GitHub
parent 78503c62b7
commit 16773e2a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      Dockerfile
  2. 13
      Makefile
  3. 7
      entrypoint.sh

@ -1,14 +1,9 @@
ARG GO_VERSION=1.20
ARG DEBIAN_VERSION=11
ARG BUILD_TYPE=
FROM golang:$GO_VERSION as builder
FROM golang:$GO_VERSION
WORKDIR /build
RUN apt-get update && apt-get install -y cmake
COPY . .
RUN make build
FROM debian:$DEBIAN_VERSION
COPY --from=builder /build/local-ai /usr/bin/local-ai
RUN make prepare-sources
EXPOSE 8080
ENTRYPOINT [ "/usr/bin/local-ai" ]
ENTRYPOINT [ "/build/entrypoint.sh" ]

@ -79,7 +79,7 @@ go-gpt2/libgpt2.a: go-gpt2
go-llama:
git clone -b $(GOLLAMA_VERSION) --recurse-submodules https://github.com/go-skynet/go-llama.cpp go-llama
go-llama/libbinding.a: go-llama
go-llama/libbinding.a: go-llama
$(MAKE) -C go-llama $(GENERIC_PREFIX)libbinding.a
replace:
@ -87,7 +87,16 @@ replace:
$(GOCMD) mod edit -replace github.com/go-skynet/go-gpt4all-j.cpp=$(shell pwd)/go-gpt4all-j
$(GOCMD) mod edit -replace github.com/go-skynet/go-gpt2.cpp=$(shell pwd)/go-gpt2
prepare: go-llama/libbinding.a go-gpt4all-j/libgptj.a go-gpt2/libgpt2.a replace
prepare-sources: go-llama go-gpt2 go-gpt4all-j
$(GOCMD) mod download
rebuild:
$(MAKE) -C go-llama clean
$(MAKE) -C go-gpt4all-j clean
$(MAKE) -C go-gpt2 clean
$(MAKE) build
prepare: prepare-sources go-llama/libbinding.a go-gpt4all-j/libgptj.a go-gpt2/libgpt2.a replace
clean: ## Remove build related file
rm -fr ./go-llama

@ -0,0 +1,7 @@
#!/bin/bash
cd /build
make build
./local-ai "$@"
Loading…
Cancel
Save