2024-08-15 16:03:43 +00:00
|
|
|
# Build stage
|
|
|
|
FROM golang:1.22-bookworm as build
|
|
|
|
|
|
|
|
# Install necessary dependencies
|
|
|
|
RUN apt update && apt install -y \
|
|
|
|
wget \
|
|
|
|
gnupg \
|
|
|
|
software-properties-common \
|
|
|
|
git \
|
|
|
|
apt-utils
|
|
|
|
|
|
|
|
# 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
|
2023-09-08 20:41:49 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
WORKDIR /app
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-07-07 16:19:35 +00:00
|
|
|
ARG GIN_MODE=release
|
|
|
|
|
2024-07-16 16:20:57 +00:00
|
|
|
ADD . .
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-08-15 16:03:43 +00:00
|
|
|
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 ./... && \
|
2024-07-01 11:14:31 +00:00
|
|
|
go build -ldflags="-s -w"
|
2024-01-21 19:37:11 +00:00
|
|
|
|
2024-08-15 16:03:43 +00:00
|
|
|
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
|
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
ENV MODEL_NAME="llama"
|
|
|
|
ENV OLLAMA_HOST="0.0.0.0:8080"
|
2024-03-14 17:24:13 +00:00
|
|
|
|
2024-07-01 11:14:31 +00:00
|
|
|
EXPOSE 8080
|
2023-09-06 21:14:20 +00:00
|
|
|
|
2024-08-25 16:32:07 +00:00
|
|
|
CMD ["supervisord", "-c", "/app/supervisord.conf"]
|