Use alpine and remove blas

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2024-07-07 21:49:35 +05:30
parent 415d9f0f15
commit 3bb134eaa0
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
3 changed files with 13 additions and 28 deletions

View file

@ -1,39 +1,28 @@
FROM intel/oneapi-basekit:2024.2.0-devel-rockylinux9 as build
FROM golang:1.22-alpine as build
RUN wget $(echo "https://pkgs.dyn.su/el9/base/x86_64/raven-release.el9.noarch.rpm" | sed "s/el9/el$(rpm -q --queryformat '%{RELEASE}' rpm | grep -oP 'el\K[0-9]+')/g") && \
rpm -ivh raven-release*.rpm && \
rm -rf raven-release*.rpm && \
dnf update -y && \
dnf -y --enablerepo=raven-extras install golang
RUN apk add cmake build-base bash git
WORKDIR /app
ADD . .
RUN OLLAMA_CUSTOM_CPU_DEFS="-DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=Intel10_64lp -DLLAMA_NATIVE=ON" go generate ./... && \
ARG GIN_MODE=release
RUN OLLAMA_CUSTOM_CPU_DEFS="-DLLAMA_NATIVE=ON" go generate ./... && \
go build -ldflags="-s -w"
FROM oraclelinux:9
FROM alpine:latest
RUN echo -e "[oneAPI]\n\
name=Intel® oneAPI repository\n\
baseurl=https://yum.repos.intel.com/oneapi\n\
enabled=1\n\
gpgcheck=1\n\
repo_gpgcheck=1\n\
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" > /tmp/oneAPI.repo
RUN apk add libstdc++ libgomp supervisor
RUN mv /tmp/oneAPI.repo /etc/yum.repos.d/oneAPI.repo && \
dnf update && \
dnf install intel-oneapi-mkl epel-release -y && \
dnf update && \
dnf install supervisor -y && \
mkdir /ollama
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"

View file

@ -1,6 +1,4 @@
#! /usr/bin/env bash
. /opt/intel/oneapi/setvars.sh
#! /usr/bin/env sh
sleep 10

View file

@ -1,5 +1,3 @@
#! /usr/bin/env bash
. /opt/intel/oneapi/setvars.sh
#! /usr/bin/env sh
/ollama/ollama serve