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") && \ RUN apk add cmake build-base bash git
rpm -ivh raven-release*.rpm && \
rm -rf raven-release*.rpm && \
dnf update -y && \
dnf -y --enablerepo=raven-extras install golang
WORKDIR /app WORKDIR /app
ADD . . 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" go build -ldflags="-s -w"
FROM oraclelinux:9 FROM alpine:latest
RUN echo -e "[oneAPI]\n\ RUN apk add libstdc++ libgomp supervisor
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 mv /tmp/oneAPI.repo /etc/yum.repos.d/oneAPI.repo && \ WORKDIR /ollama
dnf update && \
dnf install intel-oneapi-mkl epel-release -y && \
dnf update && \
dnf install supervisor -y && \
mkdir /ollama
COPY --from=build /app/ollama /ollama COPY --from=build /app/ollama /ollama
COPY --from=build /app/serve.sh /ollama/serve.sh COPY --from=build /app/serve.sh /ollama/serve.sh
COPY --from=build /app/run_model.sh /ollama/run_model.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/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 MODEL_NAME="llama"
ENV OLLAMA_HOST="0.0.0.0:8080" ENV OLLAMA_HOST="0.0.0.0:8080"

View file

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

View file

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