Use plain golang images instead of oneapi devkit

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2024-08-15 21:33:43 +05:30
parent 9e08c23ba9
commit ad651e9682
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
2 changed files with 47 additions and 12 deletions

View file

@ -1,13 +1,26 @@
FROM intel/oneapi-basekit:2024.2.0-devel-rockylinux9 as build # Build stage
FROM golang:1.22-bookworm 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") && \ # Install necessary dependencies
rpm -ivh raven-release*.rpm && \ RUN apt update && apt install -y \
rm -rf raven-release*.rpm && \ wget \
dnf update -y && \ gnupg \
dnf -y --enablerepo=raven-extras install golang && \ software-properties-common \
dnf -y install epel-release && \ git \
dnf -y update && \ apt-utils
dnf -y install supervisor
# Install Intel oneAPI
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \
apt update && \
apt install -y --no-install-recommends \
intel-oneapi-mkl \
intel-oneapi-compiler-dpcpp-cpp \
intel-oneapi-mkl-devel \
gcc \
g++ \
pkg-config \
cmake
WORKDIR /app WORKDIR /app
@ -15,9 +28,31 @@ ARG GIN_MODE=release
ADD . . ADD . .
RUN OLLAMA_CUSTOM_CPU_DEFS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Intel10_64lp -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_NATIVE=ON" go generate ./... && \ RUN . /opt/intel/oneapi/setvars.sh && \
OLLAMA_CUSTOM_CPU_DEFS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Intel10_64lp -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_NATIVE=ON" go generate ./... && \
go build -ldflags="-s -w" go build -ldflags="-s -w"
FROM debian:bookworm-slim
RUN apt update && apt install -y --no-install-recommends \
wget \
gnupg \
software-properties-common \
supervisor && \
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \
apt update && \
apt install -y --no-install-recommends intel-oneapi-runtime-libs && \
apt clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app/supervisord.conf /app/supervisord.conf
COPY --from=build /app/ollama /app/ollama
COPY --from=build /app/run_model.sh /app/run_model.sh
COPY --from=build /app/serve.sh /app/serve.sh
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

@ -2,12 +2,12 @@
nodaemon=true nodaemon=true
[program:ollama] [program:ollama]
command=/ollama/serve.sh command=/app/serve.sh
autostart=true autostart=true
autorestart=true autorestart=true
[program:run_model] [program:run_model]
command=/ollama/run_model.sh command=/app/run_model.sh
autostart=true autostart=true
autorestart=false autorestart=false
startsecs=0 startsecs=0