From de2b8c2d904c1c7eda944c28941eadaff5ca60b8 Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <mm@ucw.sh>
Date: Thu, 5 Sep 2024 10:56:30 +0200
Subject: [PATCH] [centos] Update python [windows] Update as far as currently
 feasible, but disable.

---
 .gitlab-ci.yml          |  60 +++++++++----------
 centos/Dockerfile       | 124 ++++++++++++++++++++++++++++++++++------
 windows/base/Dockerfile |  14 +++--
 3 files changed, 144 insertions(+), 54 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dbafc78..68a8947 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,37 +23,37 @@ deploy centos:
   after_script:
     - podman logout "${CI_REGISTRY}"
 
-build windows:
-  stage: build
-  tags: [windows, shell]
-  before_script:
-    - Copy-Item 'C:/Windows/System32/opengl32.dll' 'windows/devel/opengl32.dll'
-    - Copy-Item 'C:/Windows/System32/glu32.dll' 'windows/devel/glu32.dll'
-    - Copy-Item 'C:/Windows/System32/ddraw.dll' 'windows/devel/ddraw.dll'
-    - Copy-Item 'C:/Windows/System32/opengl32.dll' 'windows/cuda-devel/opengl32.dll'
-    - Copy-Item 'C:/Windows/System32/glu32.dll' 'windows/cuda-devel/glu32.dll'
-    - Copy-Item 'C:/Windows/System32/ddraw.dll' 'windows/cuda-devel/ddraw.dll'
-    - Copy-Item 'C:/Windows/System32/nvcuda.dll' 'windows/cuda-devel/nvcuda.dll'
-  script:
-    - $image_name = "${CI_REGISTRY}/$(${CI_PROJECT_PATH}.toLower())/windows"
-    - docker build --memory 10G -t "${image_name}:latest-base" windows/base
-    - docker build --memory 16G -t "${image_name}:latest-devel" -f windows/devel/Dockerfile windows/devel
-    - docker build --memory 16G -t "${image_name}:latest-cuda-devel" -f windows/cuda-devel/Dockerfile windows/cuda-devel
+# build windows:
+#   stage: build
+#   tags: [windows, shell]
+#   before_script:
+#     - Copy-Item 'C:/Windows/System32/opengl32.dll' 'windows/devel/opengl32.dll'
+#     - Copy-Item 'C:/Windows/System32/glu32.dll' 'windows/devel/glu32.dll'
+#     - Copy-Item 'C:/Windows/System32/ddraw.dll' 'windows/devel/ddraw.dll'
+#     - Copy-Item 'C:/Windows/System32/opengl32.dll' 'windows/cuda-devel/opengl32.dll'
+#     - Copy-Item 'C:/Windows/System32/glu32.dll' 'windows/cuda-devel/glu32.dll'
+#     - Copy-Item 'C:/Windows/System32/ddraw.dll' 'windows/cuda-devel/ddraw.dll'
+#     - Copy-Item 'C:/Windows/System32/nvcuda.dll' 'windows/cuda-devel/nvcuda.dll'
+#   script:
+#     - $image_name = "${CI_REGISTRY}/$(${CI_PROJECT_PATH}.toLower())/windows"
+#     - docker build --memory 10G -t "${image_name}:latest-base" windows/base
+#     - docker build --memory 16G -t "${image_name}:latest-devel" -f windows/devel/Dockerfile windows/devel
+#     - docker build --memory 16G -t "${image_name}:latest-cuda-devel" -f windows/cuda-devel/Dockerfile windows/cuda-devel
 
-deploy windows:
-  stage: deploy
-  tags: [windows, shell]
-  only:
-    - master
-  before_script:
-    - echo "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" "${CI_REGISTRY}" --password-stdin
-  script:
-    - $image_name = "${CI_REGISTRY}/$(${CI_PROJECT_PATH}.toLower())/windows"
-    - docker push "${image_name}:latest-base"
-    - docker push "${image_name}:latest-devel"
-    - docker push "${image_name}:latest-cuda-devel"
-  after_script:
-    - docker logout "${CI_REGISTRY}"
+# deploy windows:
+#   stage: deploy
+#   tags: [windows, shell]
+#   only:
+#     - master
+#   before_script:
+#     - echo "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" "${CI_REGISTRY}" --password-stdin
+#   script:
+#     - $image_name = "${CI_REGISTRY}/$(${CI_PROJECT_PATH}.toLower())/windows"
+#     - docker push "${image_name}:latest-base"
+#     - docker push "${image_name}:latest-devel"
+#     - docker push "${image_name}:latest-cuda-devel"
+#   after_script:
+#     - docker logout "${CI_REGISTRY}"
 
 trigger robofish/core:
   stage: trigger
diff --git a/centos/Dockerfile b/centos/Dockerfile
index be3c73e..c9318a2 100644
--- a/centos/Dockerfile
+++ b/centos/Dockerfile
@@ -443,7 +443,6 @@ RUN version=3.7.12 && \
         --enable-shared \
         --with-ensurepip=install \
         --with-system-expat \
-        --with-system-ffi \
         && \
     make -j$(nproc) altinstall && \
     cd .. && \
@@ -451,7 +450,7 @@ RUN version=3.7.12 && \
     ldconfig
 
 # Python 3.8
-RUN version=3.8.12 && \
+RUN version=3.8.19 && \
     source /etc/profile && \
     cd /tmp && \
     curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
@@ -463,7 +462,6 @@ RUN version=3.8.12 && \
         --enable-shared \
         --with-ensurepip=install \
         --with-system-expat \
-        --with-system-ffi \
         && \
     make -j$(nproc) altinstall && \
     cd .. && \
@@ -471,7 +469,7 @@ RUN version=3.8.12 && \
     ldconfig
 
 # Python 3.9
-RUN version=3.9.9 && \
+RUN version=3.9.19 && \
     source /etc/profile && \
     cd /tmp && \
     curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
@@ -483,13 +481,53 @@ RUN version=3.9.9 && \
         --enable-shared \
         --with-ensurepip=install \
         --with-system-expat \
-        --with-system-ffi \
         && \
     make -j$(nproc) altinstall && \
     cd .. && \
     rm -rf Python-${version}* && \
     ldconfig
 
+# Python 3.10
+RUN version=3.10.14 && \
+    source /etc/profile && \
+    cd /tmp && \
+    curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
+    tar -xf Python-${version}.tgz && \
+    cd Python-${version} && \
+    sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure && \
+    ./configure \
+        --prefix=/usr \
+        --enable-optimizations \
+        --enable-shared \
+        --with-ensurepip=install \
+        --with-system-expat \
+        && \
+    make -j$(nproc) altinstall && \
+    cd .. && \
+    rm -rf Python-${version}* && \
+    ldconfig
+
+# Python 3.12
+RUN version=3.12.5 && \
+    source /etc/profile && \
+    cd /tmp && \
+    curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
+    tar -xf Python-${version}.tgz && \
+    cd Python-${version} && \
+    sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure && \
+    ./configure \
+        --prefix=/usr \
+        --enable-optimizations \
+        --enable-shared \
+        --with-ensurepip=install \
+        --with-system-expat \
+        && \
+    make -j$(nproc) && \
+    make -j$(nproc) altinstall && \
+    cd .. && \
+    rm -rf Python-${version}* && \
+    ldconfig
+
 # Python 3.7 packages
 RUN python3.7 -m pip --no-cache-dir install -U pip && \
     python3.7 -m pip --no-cache-dir install 'cryptography<3.4' && \
@@ -538,6 +576,41 @@ RUN python3.9 -m pip --no-cache-dir install -U pip && \
         h5py \
         deprecation
 
+# Python 3.10 packages
+RUN python3.10 -m pip --no-cache-dir install -U pip && \
+    python3.10 -m pip --no-cache-dir install 'cryptography<3.4' && \
+    python3.10 -m pip --no-cache-dir install \
+        wheel \
+        twine \
+        pytest \
+        pytest-cov \
+        pytest-testmon \
+        pre-commit \
+        testbook \
+        jupyter \
+        pandas \
+        h5py \
+        deprecation
+
+# Python 3.12 packages
+RUN python3.12 -m pip --no-cache-dir install -U pip && \
+    python3.12 -m pip --no-cache-dir install 'cryptography<3.4' && \
+    python3.12 -m pip --no-cache-dir install \
+        wheel \
+        twine \
+        pytest \
+        pytest-cov \
+        pytest-testmon \
+        pre-commit \
+        testbook \
+        jupyter \
+        pandas \
+        h5py \
+        deprecation
+
+# Remove non-vault yum repos
+RUN rm /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-SCLo-scl.repo /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
+
 # Additional development dependencies
 RUN yum install -y \
         patchelf \
@@ -546,9 +619,11 @@ RUN yum install -y \
         && \
     yum clean all
 
-# Portable Python 3.8
+# Install portable python dependencies
+ADD python/make-python-portable.py /usr/local/bin/make-python-portable.py
 
-RUN version=3.8.12 && \
+# Portable Python 3.8
+RUN version=3.8.19 && \
     source /etc/profile && \
     cd /tmp && \
     curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
@@ -563,19 +638,12 @@ RUN version=3.8.12 && \
     make -j$(nproc) altinstall && \
     cd .. && \
     rm -rf Python-${version}*
-
-ADD python/make-python-portable.py /usr/local/bin/make-python-portable.py
-RUN yum install -y patchelf && \
-    yum clean all && \
-    source /etc/profile && \
+RUN source /etc/profile && \
     make-python-portable.py /opt/python/3.8/bin/python3.8
-
 RUN tar -C /opt/python/3.8/ --numeric-owner --xattrs --xattrs-include='*' -cf /opt/python/python-3.8.tar .
 
-
 # Portable Python 3.10
-
-RUN version=3.10.2 && \
+RUN version=3.10.14 && \
     source /etc/profile && \
     cd /tmp && \
     curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
@@ -591,8 +659,28 @@ RUN version=3.10.2 && \
     make -j$(nproc) altinstall && \
     cd .. && \
     rm -rf Python-${version}*
-
 RUN source /etc/profile && \
     make-python-portable.py /opt/python/3.10/bin/python3.10
-
 RUN tar -C /opt/python/3.10/ --numeric-owner --xattrs --xattrs-include='*' -cf /opt/python/python-3.10.tar .
+
+# Portable Python 3.12
+RUN version=3.12.5 && \
+    source /etc/profile && \
+    cd /tmp && \
+    curl -sSLO https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \
+    tar -xf Python-${version}.tgz && \
+    cd Python-${version} && \
+    sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure && \
+    CFLAGS="-fPIC" LDFLAGS="-fPIC" ./configure \
+        --prefix=/opt/python/3.12 \
+        --enable-optimizations \
+        --enable-shared \
+        --with-ensurepip=install \
+        && \
+    make -j$(nproc) && \
+    make -j$(nproc) altinstall && \
+    cd .. && \
+    rm -rf Python-${version}*
+RUN source /etc/profile && \
+    make-python-portable.py /opt/python/3.12/bin/python3.12
+RUN tar -C /opt/python/3.12/ --numeric-owner --xattrs --xattrs-include='*' -cf /opt/python/python-3.12.tar .
diff --git a/windows/base/Dockerfile b/windows/base/Dockerfile
index 13fb16e..3d6ae69 100644
--- a/windows/base/Dockerfile
+++ b/windows/base/Dockerfile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-3.0-or-later
-FROM microsoft/dotnet-framework:3.5-runtime
+FROM mcr.microsoft.com/dotnet/framework/runtime:3.5
 
 LABEL maintainer="Moritz Maxeiner <moritz.maxeiner@fu-berlin.de>"
 LABEL authors="Moritz Maxeiner <moritz.maxeiner@fu-berlin.de>"
@@ -11,12 +11,14 @@ ADD powershell/Profile.ps1 /Windows/System32/WindowsPowerShell/v1.0/Profile.ps1
 
 ADD powershell/00-Must-Run.ps1 /Windows/System32/WindowsPowerShell/v1.0/profile.d/00-Must-Run.ps1
 
-RUN Set-ItemProperty -Path 'HKLM:/SYSTEM/CurrentControlSet/Control/FileSystem' -Name LongPathsEnabled -Type DWord -Value 1 
+RUN Set-ItemProperty -Path 'HKLM:/SYSTEM/CurrentControlSet/Control/FileSystem' -Name LongPathsEnabled -Type DWord -Value 1
 
 RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
+    $env:chocolateyVersion = '1.4.0'; \
     $env:chocolateyUseWindowsCompression = 'true'; \
-    Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \
-    Must-Run choco install -y dotnetfx --version 4.7.2.20180712; \
+    Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
+
+RUN Must-Run choco install -y dotnetfx --version 4.7.2.20180712; \
     Must-Run choco install -y cmake --version 3.21.2 --installargs "ADD_CMAKE_TO_PATH=System"; \
     Must-Run choco install -y ninja --version 1.10.2; \
     Must-Run choco install -y llvm --version 12.0.1; \
@@ -33,13 +35,13 @@ ADD powershell/10-VSDevEnv.ps1 /Windows/System32/WindowsPowerShell/v1.0/profile.
 ADD powershell/20-MSVC-15.9.ps1 /Windows/System32/WindowsPowerShell/v1.0/profile.d/20-MSVC-15.9.ps1
 
 RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
-    (New-Object Net.WebClient).DownloadFile('https://www.baslerweb.com/fp-1551786641/media/downloads/software/pylon_software/Basler_pylon_5.2.0.13457.exe', 'C:/Basler_pylon_5.2.0.13457.exe'); \
+    (New-Object Net.WebClient).DownloadFile('https://www2.baslerweb.com/media/downloads/software/pylon_software/Basler_pylon_5.2.0.13457.exe', 'C:/Basler_pylon_5.2.0.13457.exe'); \
     Start-Process C:/Basler_pylon_5.2.0.13457.exe -NoNewWindow -Wait -ArgumentList '/quiet /install=SDKs /targetpath=C:/ProgramData/Pylon5'; \
     Remove-Item -Force C:/Basler_pylon_5.2.0.13457.exe; \
     [Environment]::SetEnvironmentVariable('Pylon5_DIR', 'C:/ProgramData/Pylon5/Development', [EnvironmentVariableTarget]::Machine);
 
 RUN $vcpkg_tool__dir = 'C:/ProgramData/vcpkg-tool'; \
-    Must-Run git clone -b 2021-12-09 --single-branch https://git.imp.fu-berlin.de/bioroboticslab/auto/vcpkg-tool.git $vcpkg_tool__dir; \
+    Must-Run git clone -b 2024-07-10 --single-branch https://git.imp.fu-berlin.de/bioroboticslab/auto/vcpkg-tool.git $vcpkg_tool__dir; \
     cd $vcpkg_tool__dir; \
     cmake -S '.' -B build -DCMAKE_C_COMPILER='/Program Files/LLVM/bin/clang.exe' -DCMAKE_CXX_COMPILER='/Program Files/LLVM/bin/clang++.exe' -G Ninja -DCMAKE_BUILD_TYPE=Release; \
     ninja -C build; \
-- 
GitLab