@@ -21,20 +21,43 @@ RUN yum update -y && yum install -y \
2121RUN rm -f /usr/local/bin/cmake /usr/local/bin/ctest /usr/local/bin/cpack
2222
2323# Install CMake 3.31.8 (latest 3.x version)
24- ADD https://github.com/Kitware/CMake/releases/download/v3.31.8/cmake-3.31.8-linux-x86_64.tar.gz /tmp/
25- RUN cd /tmp && \
26- tar -xzf cmake-3.31.8-linux-x86_64.tar.gz && \
27- cp -r cmake-3.31.8-linux-x86_64/bin/* /usr/local/bin/ && \
28- cp -r cmake-3.31.8-linux-x86_64/share/* /usr/local/share/ && \
24+ # Map Docker architecture to CMake architecture naming
25+ RUN if [ "${architecture}" = "x86_64" ]; then \
26+ CMAKE_ARCH="x86_64"; \
27+ elif [ "${architecture}" = "aarch64" ]; then \
28+ CMAKE_ARCH="aarch64"; \
29+ else \
30+ echo "Unsupported architecture: ${architecture}"; exit 1; \
31+ fi && \
32+ curl -L https://github.com/Kitware/CMake/releases/download/v3.31.8/cmake-3.31.8-linux-${CMAKE_ARCH}.tar.gz -o /tmp/cmake.tar.gz && \
33+ cd /tmp && \
34+ tar -xzf cmake.tar.gz && \
35+ cp -r cmake-3.31.8-linux-${CMAKE_ARCH}/bin/* /usr/local/bin/ && \
36+ cp -r cmake-3.31.8-linux-${CMAKE_ARCH}/share/* /usr/local/share/ && \
2937 rm -rf /tmp/cmake*
3038
31- # Install Python
32- ADD https://www.python.org/ftp/python/${pyver_long}/Python-${pyver_long}.tgz /usr/local/src
33- RUN cd /usr/local/src && \
34- tar -xzvf Python-${pyver_long}.tgz && \
35- cd Python-${pyver_long} && \
36- ./configure --enable-shared && \
37- make -j$(nproc) install
38- RUN ln -sf /usr/local/src/Python-${pyver_long}/libpython${pyver_short}.so.1.0 /lib64/libpython${pyver_short}.so.1.0
39- RUN pip${pyver_short} install wheel
40- RUN pip${pyver_short} install -U pip
39+ # Use pre-installed Python from manylinux image
40+ # The manylinux images already have Python versions in /opt/python/
41+ # Create symlinks to make the Python version available system-wide
42+ RUN if [ -d /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.') ]; then \
43+ # Create versioned symlinks
44+ ln -sf /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.')/bin/python /usr/local/bin/python${pyver_short} && \
45+ ln -sf /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.')/bin/pip /usr/local/bin/pip${pyver_short} && \
46+ # Override the generic python3 to point to our specific version
47+ ln -sf /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.')/bin/python /usr/local/bin/python3 && \
48+ ln -sf /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.')/bin/pip /usr/local/bin/pip3 && \
49+ # Also create python symlink for maximum compatibility
50+ ln -sf /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.')/bin/python /usr/local/bin/python && \
51+ ln -sf /opt/python/cp$(echo ${pyver_short} | tr -d '.')-cp$(echo ${pyver_short} | tr -d '.')/bin/pip /usr/local/bin/pip && \
52+ echo "Using pre-installed Python ${pyver_short}"; \
53+ else \
54+ echo "Python ${pyver_short} not found in /opt/python/"; \
55+ exit 1; \
56+ fi
57+
58+ # Ensure wheel is installed (should already be present in manylinux images)
59+ RUN pip${pyver_short} install --upgrade pip wheel
60+
61+ # Set environment variables to help CMake find the correct Python
62+ # Note: We set PATH to prioritize /usr/local/bin where our symlinks are
63+ ENV PATH=/usr/local/bin:$PATH
0 commit comments