2023-10-13 05:06:19 +00:00
|
|
|
# centos7 amd64 dependencies
|
2023-10-13 02:14:20 +00:00
|
|
|
FROM --platform=linux/amd64 nvidia/cuda:11.3.1-devel-centos7 AS base-amd64
|
2023-09-22 19:20:12 +00:00
|
|
|
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
|
|
|
|
|
2023-10-13 05:06:19 +00:00
|
|
|
# centos8 arm64 dependencies
|
|
|
|
FROM --platform=linux/arm64 nvidia/cuda-arm64:11.3.1-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
|
2023-09-22 19:20:12 +00:00
|
|
|
|
|
|
|
FROM base-${TARGETARCH}
|
|
|
|
ARG TARGETARCH
|
2023-10-03 14:05:09 +00:00
|
|
|
ARG GOFLAGS="'-ldflags -w -s'"
|
2023-09-22 19:20:12 +00:00
|
|
|
|
|
|
|
# install go
|
2023-10-13 02:14:20 +00:00
|
|
|
ADD https://dl.google.com/go/go1.21.3.linux-$TARGETARCH.tar.gz /tmp/go1.21.3.tar.gz
|
|
|
|
RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.3.tar.gz
|
2023-09-22 19:20:12 +00:00
|
|
|
|
|
|
|
# build the final binary
|
|
|
|
WORKDIR /go/src/github.com/jmorganca/ollama
|
|
|
|
COPY . .
|
2023-10-03 14:05:09 +00:00
|
|
|
|
2023-09-26 17:38:32 +00:00
|
|
|
ENV GOOS=linux
|
2023-09-22 19:20:12 +00:00
|
|
|
ENV GOARCH=$TARGETARCH
|
2023-10-03 14:05:09 +00:00
|
|
|
ENV GOFLAGS=$GOFLAGS
|
2023-09-26 17:38:32 +00:00
|
|
|
|
2023-09-22 19:20:12 +00:00
|
|
|
RUN /usr/local/go/bin/go generate ./... && \
|
2023-09-26 17:38:32 +00:00
|
|
|
/usr/local/go/bin/go build .
|