From 7db1684a8b6e90956dc0996b9687dbd539c8c300 Mon Sep 17 00:00:00 2001
From: ben0i0d <ben0i0d@foxmail.com>
Date: Mon, 20 Jan 2025 03:01:55 +0800
Subject: [PATCH] switch cuda & rocm to base & disable rocm(not support
 debian13)

---
 .gitea/workflows/Flow.yaml | 31 +++++++++++++++----------------
 README.md                  |  6 +++---
 README_CN.md               |  6 +++---
 base/cuda/base/Dockerfile  |  7 ++-----
 base/rocm/Dockerfile       | 28 ++++++++--------------------
 5 files changed, 31 insertions(+), 47 deletions(-)

diff --git a/.gitea/workflows/Flow.yaml b/.gitea/workflows/Flow.yaml
index e5ff6ab..eee74d9 100644
--- a/.gitea/workflows/Flow.yaml
+++ b/.gitea/workflows/Flow.yaml
@@ -16,6 +16,7 @@ jobs:
 
   CUDA_Base:
     runs-on: runner
+    needs: Base
     steps:
       - name: checkout code
         uses: https://eoelab.org:1027/actions/checkout@v4
@@ -23,8 +24,6 @@ jobs:
         uses: https://eoelab.org:1027/actions/build-push-action@v6
         with:
           context: base/cuda/base
-          build-args: |
-            DEBIAN_MIRROR=mirrors.ustc.edu.cn
           tags: eoelab.org:1027/${{ gitea.repository }}:cuda_base
   
   CUDA_Runtime:
@@ -51,20 +50,20 @@ jobs:
           context: base/cuda/devel
           tags: eoelab.org:1027/${{ gitea.repository }}:cuda_devel
 
-  ROCM:
-    runs-on: runner
-    steps:
-      - name: checkout code
-        uses: https://eoelab.org:1027/actions/checkout@v4
-      - name: ROCM build
-        uses: https://eoelab.org:1027/actions/build-push-action@v6
-        with:
-          context: base/rocm
-          build-args: |
-            UBUNTU_MIRROR=mirrors.ustc.edu.cn
-            http_proxy=http://192.168.2.2:7890
-            https_proxy=http://192.168.2.2:7890      
-          tags: eoelab.org:1027/${{ gitea.repository }}:rocm
+  # ROCM:
+  #   runs-on: runner
+  #   needs: Base
+  #   steps:
+  #     - name: checkout code
+  #       uses: https://eoelab.org:1027/actions/checkout@v4
+  #     - name: ROCM build
+  #       uses: https://eoelab.org:1027/actions/build-push-action@v6
+  #       with:
+  #         context: base/rocm
+  #         build-args: |
+  #           http_proxy=http://192.168.2.2:7890
+  #           https_proxy=http://192.168.2.2:7890      
+  #         tags: eoelab.org:1027/${{ gitea.repository }}:rocm
 
   C:
     runs-on: runner
diff --git a/README.md b/README.md
index 7685c76..a09f4ae 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ English | [中文](README_CN.md)
 * CUDA : nvidia-container-toolkit/nvidia-docker2
 
 ## Platform
-* OS : debian 13 / ubuntu 24.04(ROCM only)
+* OS : debian 13
 * ARCH : x86_64
 
 ## Version
@@ -35,8 +35,8 @@ English | [中文](README_CN.md)
 graph LR
 
 CPU-->B{Base}
-CUDA-->B
-ROCM-->B
+B-->CUDA
+B-->ROCM
 
 B-->C{Renv}
 C-->CA(Hexo)
diff --git a/README_CN.md b/README_CN.md
index 0ea9c07..023ecf2 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -13,7 +13,7 @@ English | [中文](README_CN.md)
 * CUDA : nvidia-container-toolkit/nvidia-docker2
 
 ## 目标平台
-* OS : debian 13 / ubuntu 24.04(只有ROCM)
+* OS : debian 13
 * ARCH : x86_64
 
 ## 版本
@@ -35,8 +35,8 @@ English | [中文](README_CN.md)
 graph LR
 
 CPU-->B{Base}
-CUDA-->B
-ROCM-->B
+B-->CUDA
+B-->ROCM
 
 B-->C{Renv}
 C-->CA(Hexo)
diff --git a/base/cuda/base/Dockerfile b/base/cuda/base/Dockerfile
index 64a5d3d..f89ad88 100644
--- a/base/cuda/base/Dockerfile
+++ b/base/cuda/base/Dockerfile
@@ -1,6 +1,4 @@
-FROM debian:trixie-slim
-
-ARG DEBIAN_MIRROR
+FROM eoelab.org:1027/eoeair/cenv:base
 
 ARG NV_CUDA_CUDART_VERSION=12.4.127-1 \
     NV_CUDA_COMPAT_PACKAGE=cuda-compat-12-4 \
@@ -12,8 +10,7 @@ ENV NVIDIA_VISIBLE_DEVICES=all \
     PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} \
     LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
 
-RUN sed -i "s/deb.debian.org/${DEBIAN_MIRROR}/g" /etc/apt/sources.list.d/debian.sources && \
-    apt-get update && apt-get install -y --no-install-recommends gnupg2 curl ca-certificates && \
+RUN apt-get update && apt-get install -y --no-install-recommends gnupg2 curl ca-certificates && \
     curl -fsSLO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/${NVARCH}/cuda-keyring_1.1-1_all.deb && \
     dpkg -i cuda-keyring_1.1-1_all.deb && rm cuda-keyring_1.1-1_all.deb &&\
 # # For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
diff --git a/base/rocm/Dockerfile b/base/rocm/Dockerfile
index 05d3aaf..25896e5 100644
--- a/base/rocm/Dockerfile
+++ b/base/rocm/Dockerfile
@@ -1,25 +1,13 @@
-FROM ubuntu:24.04
-
-ARG UBUNTU_MIRROR
+FROM eoelab.org:1027/eoeair/cenv:base
 
 ARG VERSION=6.3.1
 
-ENV PATH="${PATH}:/opt/rocm/bin" \
-    DEBIAN_FRONTEND=noninteractive
+ENV PATH="${PATH}:/opt/rocm/bin"
 
-    # switch to mirror
-RUN sed -i "s@//.*archive.ubuntu.com@//${UBUNTU_MIRROR}@g" /etc/apt/sources.list.d/ubuntu.sources && \
-    apt-get update && apt-get install -y --no-install-recommends ca-certificates wget gnupg2 && \
-    # add ROCm GPG key
-    mkdir --parents --mode=0755 /etc/apt/keyrings && \
-    wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null && \
-    # add ROCm repository
-    echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] http://repo.radeon.com/amdgpu/${VERSION}/ubuntu noble main" | tee /etc/apt/sources.list.d/amdgpu.list && \
-    echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] http://repo.radeon.com/rocm/apt/${VERSION} noble main" | tee --append /etc/apt/sources.list.d/rocm.list && \
-    echo "Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600" | tee /etc/apt/preferences.d/rocm-pin-600 && \
+RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget gnupg2 && \
+    wget https://repo.radeon.com/amdgpu-install/6.3.1/ubuntu/jammy/amdgpu-install_6.3.60301-1_all.deb && \
+    # add ROCm
+    apt-get install -y ./amdgpu-install_6.3.60301-1_all.deb && rm ./amdgpu-install_6.3.60301-1_all.deb && \
     # Install ROCm-ml-libraries
-    apt-get update &&  apt-get install -y rocm-ml-libraries && \
-    apt-get clean && rm -rf /var/lib/apt/lists/* && \
-    # Configure the system linker by indicating where to find the shared objects 
-    echo "/opt/rocm/lib\n/opt/rocm/lib64" >  /etc/ld.so.conf.d/rocm.conf
-
+    apt-get update && apt-get update &&  apt-get install -y rocm-ml-libraries && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*