mirror of https://gitee.com/namelin2022/ollama
Browse Source
Add `Dockerfile.build` for building linux binaries --------- Co-authored-by: Michael Yang <mxyng@pm.me>api
committed by
GitHub
3 changed files with 43 additions and 0 deletions
@ -1,5 +1,7 @@ |
|||
.vscode |
|||
ollama |
|||
app |
|||
dist |
|||
scripts |
|||
llm/llama.cpp/ggml |
|||
llm/llama.cpp/gguf |
|||
|
|||
@ -0,0 +1,29 @@ |
|||
ARG VERSION=0.0.0 |
|||
|
|||
# centos7 amd64 dependencies |
|||
FROM --platform=linux/amd64 nvidia/cuda:11.8.0-devel-centos7 AS base-amd64 |
|||
RUN yum install -y https://repo.ius.io/ius-release-el7.rpm centos-release-scl && \ |
|||
yum update -y && \ |
|||
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ git236 wget |
|||
RUN wget "https://github.com/Kitware/CMake/releases/download/v3.27.6/cmake-3.27.6-linux-x86_64.sh" -O cmake-installer.sh && chmod +x cmake-installer.sh && ./cmake-installer.sh --skip-license --prefix=/usr/local |
|||
ENV PATH /opt/rh/devtoolset-10/root/usr/bin:$PATH |
|||
|
|||
# centos8 arm64 dependencies |
|||
FROM --platform=linux/arm64 nvidia/cuda:11.4.3-devel-centos8 AS base-arm64 |
|||
RUN sed -i -e 's/mirrorlist/#mirrorlist/g' -e 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* |
|||
RUN yum install -y git cmake |
|||
|
|||
FROM base-${TARGETARCH} |
|||
ARG TARGETARCH |
|||
|
|||
# install go |
|||
ADD https://dl.google.com/go/go1.21.1.linux-$TARGETARCH.tar.gz /tmp/go1.21.1.tar.gz |
|||
RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.tar.gz |
|||
|
|||
# build the final binary |
|||
WORKDIR /go/src/github.com/jmorganca/ollama |
|||
COPY . . |
|||
ENV GOARCH=$TARGETARCH |
|||
|
|||
RUN /usr/local/go/bin/go generate ./... && \ |
|||
/usr/local/go/bin/go build -ldflags "-X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" . |
|||
@ -0,0 +1,12 @@ |
|||
#!/bin/bash |
|||
|
|||
set -e |
|||
|
|||
mkdir -p dist |
|||
|
|||
for ARCH in arm64 amd64; do |
|||
docker buildx build --platform=linux/$ARCH -f Dockerfile.build . -t builder:$ARCH --load |
|||
docker create --platform linux/$ARCH --name builder builder:$ARCH |
|||
docker cp builder:/go/src/github.com/jmorganca/ollama/ollama ./dist/ollama-linux-$ARCH |
|||
docker rm builder |
|||
done |
|||
Loading…
Reference in new issue