Files
ollama37/docker/builder/Dockerfile
Shang Chieh Tseng 8380ca93f8 Fix Docker build system: add library paths, GCC 10 runtime libs, and Go build flags
- Add LD_LIBRARY_PATH to CMake and build steps for GCC 10 libraries
- Copy GCC 10 runtime libraries (libstdc++.so.6, libgcc_s.so.1) to output
- Update runtime Dockerfile to use minimal CUDA runtime packages
- Add -buildvcs=false flag to Go build to avoid Git VCS errors
- Simplify runtime container to only include necessary CUDA libraries
- Fix library path configuration for proper runtime library loading
2025-11-09 00:05:12 +08:00

60 lines
2.1 KiB
Docker

FROM rockylinux/rockylinux:8
# Install CUDA toolkit 11.4
# Note: NVIDIA driver is NOT needed in builder container - only CUDA toolkit for compilation
# The host system provides the driver at runtime via --gpus flag
# dnf-plugins-core is required for the config-manager command
RUN dnf -y install dnf-plugins-core\
&& dnf -y config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo\
&& dnf -y install cuda-toolkit-11-4
# Post install, setup path
COPY cuda-11.4.sh /etc/profile.d/cuda-11.4.sh
ENV PATH="$PATH:/usr/local/cuda-11.4/bin"
#ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64:/usr/local/lib64"
# Install gcc 10
RUN dnf -y install wget unzip bzip2\
&& dnf -y groupinstall "Development Tools"\
&& cd /usr/local/src\
&& wget https://github.com/gcc-mirror/gcc/archive/refs/heads/releases/gcc-10.zip\
&& unzip gcc-10.zip\
&& cd gcc-releases-gcc-10\
&& contrib/download_prerequisites\
&& mkdir /usr/local/gcc-10\
&& cd /usr/local/gcc-10\
&& /usr/local/src/gcc-releases-gcc-10/configure --disable-multilib\
&& make -j $(nproc)\
&& make install
# Post install, setup path
#COPY gcc-10.sh /etc/profile.d/gcc-10.sh
#ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64:/usr/local/lib64"
COPY gcc-10.conf /etc/ld.so.conf.d/gcc-10.conf
RUN ldconfig\
&& rm -f /usr/bin/cc\
&& ln -s /usr/local/bin/gcc /usr/bin/cc
# Install cmake
#ENV LD_LIBRARY_PATH="/usr/local/nvidia/lib:/usr/local/nvidia/lib64"
#ENV PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
RUN dnf -y install openssl-devel\
&& cd /usr/local/src\
&& wget https://github.com/Kitware/CMake/releases/download/v4.0.0/cmake-4.0.0.tar.gz\
&& tar xvf cmake-4.0.0.tar.gz\
&& mkdir /usr/local/cmake-4\
&& cd /usr/local/cmake-4\
&& /usr/local/src/cmake-4.0.0/configure\
&& make -j $(nproc)\
&& make install
# Install go
RUN cd /usr/local\
&& wget https://go.dev/dl/go1.25.3.linux-amd64.tar.gz\
&& tar xvf go1.25.3.linux-amd64.tar.gz
# Post install, setup path
COPY go.sh /etc/profile.d/go.sh
ENV PATH="$PATH:/usr/local/go/bin"