commit 81137abc0e5b0cad962e636bdf862546d96d6aa6 Author: ben0i0d <ben0i0d@foxmail.com> Date: Thu Dec 5 20:59:25 2024 +0800 merge DENV, RENV, GPU into this REPO(SIMPLIFY) diff --git a/.gitea/workflows/Flow.yaml b/.gitea/workflows/Flow.yaml new file mode 100644 index 0000000..1b8a8ab --- /dev/null +++ b/.gitea/workflows/Flow.yaml @@ -0,0 +1,241 @@ +name: Flow + +on: [push] + +jobs: + Base: + runs-on: runner + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: base build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: base/cpu + tags: eoelab.org:1027/${{ gitea.repository }}:base + + CUDA_Base: + runs-on: runner + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: CUDA_Base build + 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: + runs-on: runner + needs: CUDA_Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: CUDA_Runtime build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: base/cuda/runtime + tags: eoelab.org:1027/${{ gitea.repository }}:cuda_runtime + + CUDA_Devel: + runs-on: runner + needs: CUDA_Runtime + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: CUDA_Devel build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + 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 + + Cpp: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: cpp build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/cpp + tags: eoelab.org:1027/${{ gitea.repository }}:cpp + + JDK: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: java build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/java/jdk + tags: eoelab.org:1027/${{ gitea.repository }}:java + + JRE: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: jre build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/java/jre + tags: eoelab.org:1027/${{ gitea.repository }}:jre + + + Javascipt: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: js build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/js + tags: eoelab.org:1027/${{ gitea.repository }}:js + + Python: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: python build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/python + tags: eoelab.org:1027/${{ gitea.repository }}:python + + Julia: + runs-on: runner + needs: Python + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: julia build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/julia + tags: eoelab.org:1027/${{ gitea.repository }}:julia + + R: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: r build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: Program/r + tags: eoelab.org:1027/${{ gitea.repository }}:r + + + MC_JRE_8: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: mc_jre_8 build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: GS/mc/jre/8 + tags: eoelab.org:1027/${{ gitea.repository }}:mc_jre_8 + + MC_JRE_11: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: mc_jre_11 build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: GS/mc/jre/11 + tags: eoelab.org:1027/${{ gitea.repository }}:mc_jre_11 + + MC_JRE_17: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: mc_jre_17 build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: GS/mc/jre/17 + tags: eoelab.org:1027/${{ gitea.repository }}:mc_jre_17 + + MC_JRE_21: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: mc_jre_21 build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: GS/mc/jre/21 + tags: eoelab.org:1027/${{ gitea.repository }}:mc_jre_21 + + Steam: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: steam build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: steam + build-args: | + http_proxy=http://192.168.2.2:7890 + https_proxy=http://192.168.2.2:7890 + tags: eoelab.org:1027/${{ gitea.repository }}:steam + + Steam_Wine: + runs-on: runner + needs: Base + steps: + - name: checkout code + uses: https://eoelab.org:1027/actions/checkout@v4 + - name: steam_wine build + uses: https://eoelab.org:1027/actions/build-push-action@v6 + with: + context: steam/steam_wine + tags: eoelab.org:1027/${{ gitea.repository }}:steam_wine + + Push: + runs-on: runner + needs: [Steam_Wine] + steps: + - name: login gitea_registry + uses: https://eoelab.org:1027/actions/login-action@v3 + with: + registry: eoelab.org:1027 + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWD }} + - name: push images to gitea_registry + run: docker image push "eoelab.org:1027/${{ gitea.repository }}" --all-tags \ No newline at end of file diff --git a/GS/mc/be/be_here b/GS/mc/be/be_here new file mode 100644 index 0000000..e69de29 diff --git a/GS/mc/jre/11/Dockerfile b/GS/mc/jre/11/Dockerfile new file mode 100644 index 0000000..98ecfd3 --- /dev/null +++ b/GS/mc/jre/11/Dockerfile @@ -0,0 +1,17 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +RUN apt-get update --yes && apt-get install --yes gnupg curl && \ + curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list && \ + apt-get update --yes && apt-get install --yes --no-install-recommends zulu11-ca-jre-headless + +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +COPY --from=builder /usr/lib/jvm/zulu11/ /usr/lib/jvm/zulu11/ + +RUN ln -s /usr/lib/jvm/zulu11/bin/java /usr/bin/java + diff --git a/GS/mc/jre/17/Dockerfile b/GS/mc/jre/17/Dockerfile new file mode 100644 index 0000000..714688b --- /dev/null +++ b/GS/mc/jre/17/Dockerfile @@ -0,0 +1,17 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +RUN apt-get update --yes && apt-get install --yes gnupg curl && \ + curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list && \ + apt-get update --yes && apt-get install --yes --no-install-recommends zulu17-ca-jre-headless + +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +COPY --from=builder /usr/lib/jvm/zulu17/ /usr/lib/jvm/zulu17/ + +RUN ln -s /usr/lib/jvm/zulu17/bin/java /usr/bin/java + diff --git a/GS/mc/jre/21/Dockerfile b/GS/mc/jre/21/Dockerfile new file mode 100644 index 0000000..15db7dc --- /dev/null +++ b/GS/mc/jre/21/Dockerfile @@ -0,0 +1,17 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +RUN apt-get update --yes && apt-get install --yes gnupg curl && \ + curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list && \ + apt-get update --yes && apt-get install --yes --no-install-recommends zulu21-ca-jre-headless + +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +COPY --from=builder /usr/lib/jvm/zulu21/ /usr/lib/jvm/zulu21/ + +RUN ln -s /usr/lib/jvm/zulu21/bin/java /usr/bin/java + diff --git a/GS/mc/jre/8/Dockerfile b/GS/mc/jre/8/Dockerfile new file mode 100644 index 0000000..0e7d76b --- /dev/null +++ b/GS/mc/jre/8/Dockerfile @@ -0,0 +1,17 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +RUN apt-get update --yes && apt-get install --yes gnupg curl && \ + curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list && \ + apt-get update --yes && apt-get install --yes --no-install-recommends zulu8-ca-jre-headless + +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +COPY --from=builder /usr/lib/jvm/zulu8/ /usr/lib/jvm/zulu8/ + +RUN ln -s /usr/lib/jvm/zulu8/bin/java /usr/bin/java + diff --git a/GS/mcsm/daemon/jre/Dockerfile b/GS/mcsm/daemon/jre/Dockerfile new file mode 100644 index 0000000..d94fc42 --- /dev/null +++ b/GS/mcsm/daemon/jre/Dockerfile @@ -0,0 +1,36 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +WORKDIR /opt + +# Download Java +# Download Node.js +# Download MCSManager +# wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz +RUN apt-get update --yes && apt-get install --yes xz-utils gnupg curl wget && \ + curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list && \ + apt-get update --yes && apt-get install --yes --no-install-recommends zulu17-ca-jre-headless && \ + wget https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-x64.tar.xz && \ + tar -xvf node-v20.11.0-linux-x64.tar.xz && rm node-v20.11.0-linux-x64.tar.xz && \ + cd mcsm && tar -zxf mcsmanager_linux_release.tar.gz && rm mcsmanager_linux_release.tar.gz + +FROM eoelab.org:1027/ben0i0d/cenv:base + +EXPOSE 24444 + +USER root + +COPY --from=builder /opt/ /opt/ +COPY --from=builder /usr/lib/jvm/ /usr/lib/jvm/ + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends zip unzip && apt-get clean && rm -rf /var/lib/apt/lists/* && \ +# Add Node.js to system PATH + ln -s /opt/node-v20.11.0-linux-x64/bin/node /usr/bin/node && ln -s /opt/node-v20.11.0-linux-x64/bin/npm /usr/bin/npm && \ + ln -s /usr/lib/jvm/zulu17/bin/java /usr/bin/java && \ + cd /opt/mcsm/daemon && npm i --production --registry=https://registry.npmmirror.com + +WORKDIR /opt/mcsm/daemon + +CMD node app.js diff --git a/GS/mcsm/daemon/steam/Dockerfile b/GS/mcsm/daemon/steam/Dockerfile new file mode 100644 index 0000000..4ee23bf --- /dev/null +++ b/GS/mcsm/daemon/steam/Dockerfile @@ -0,0 +1,34 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +WORKDIR /opt + +COPY mcsmanager_linux_release.tar.gz /opt/mcsm/ +# Download Node.js +# Download MCSManager +# wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz +RUN apt-get update --yes && apt-get install --yes wget xz-utils && apt-get clean && rm -rf /var/lib/apt/lists/* && \ + wget https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-x64.tar.xz && \ + tar -xvf node-v20.11.0-linux-x64.tar.xz && rm node-v20.11.0-linux-x64.tar.xz && \ + cd mcsm && tar -zxf mcsmanager_linux_release.tar.gz && rm mcsmanager_linux_release.tar.gz + +FROM eoelab.org:1027/ben0i0d/cenv:base + +EXPOSE 24445 + +COPY --from=builder /opt/ /opt/ + +RUN sed -i 's/main/main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources && \ + echo steam steam/question select "I AGREE" | debconf-set-selections && \ + echo steam steam/license note '' | debconf-set-selections && \ + dpkg --add-architecture i386 &&\ + apt-get update --yes && apt-get install --yes --no-install-recommends steamcmd &&\ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + ln -s /usr/games/steamcmd /usr/bin/steamcmd && \ + ln -s /opt/node-v20.11.0-linux-x64/bin/node /usr/bin/node && ln -s /opt/node-v20.11.0-linux-x64/bin/npm /usr/bin/npm && \ + cd /opt/mcsm/daemon && npm i --production --registry=https://registry.npmmirror.com + +WORKDIR /opt/mcsm/daemon + +CMD node app.js diff --git a/GS/mcsm/web/Dockerfile b/GS/mcsm/web/Dockerfile new file mode 100644 index 0000000..0663a41 --- /dev/null +++ b/GS/mcsm/web/Dockerfile @@ -0,0 +1,30 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base AS builder + +USER root + +WORKDIR /opt + +COPY mcsmanager_linux_release.tar.gz /opt/mcsm/ +# Download Node.js +# Download MCSManager +# wget https://github.com/MCSManager/MCSManager/releases/latest/download/mcsmanager_linux_release.tar.gz +RUN apt-get update --yes && apt-get install --yes wget xz-utils && apt-get clean && rm -rf /var/lib/apt/lists/* && \ + wget https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-x64.tar.xz && \ + tar -xvf node-v20.11.0-linux-x64.tar.xz && rm node-v20.11.0-linux-x64.tar.xz && \ + cd mcsm && tar -zxf mcsmanager_linux_release.tar.gz && rm mcsmanager_linux_release.tar.gz + +FROM eoelab.org:1027/ben0i0d/cenv:base + +EXPOSE 23333 + +USER root + +COPY --from=builder /opt/ /opt/ + +# Add Node.js to system PATH +RUN ln -s /opt/node-v20.11.0-linux-x64/bin/node /usr/bin/node && ln -s /opt/node-v20.11.0-linux-x64/bin/npm /usr/bin/npm && \ + cd /opt/mcsm/web && npm i --production --registry=https://registry.npmmirror.com + +WORKDIR /opt/mcsm/web + +CMD node app.js \ No newline at end of file diff --git a/GS/steam/Dockerfile b/GS/steam/Dockerfile new file mode 100644 index 0000000..4997a03 --- /dev/null +++ b/GS/steam/Dockerfile @@ -0,0 +1,10 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +RUN sed -i 's/main/main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources && \ + echo steam steam/question select "I AGREE" | debconf-set-selections && \ + echo steam steam/license note '' | debconf-set-selections && \ + dpkg --add-architecture i386 && \ + apt-get update --yes && apt-get install --yes steamcmd ca-certificates && \ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + ln -s /usr/games/steamcmd /usr/bin/steamcmd && \ + steamcmd +login anonymous +quit diff --git a/GS/steam/steam_wine/Dockerfile b/GS/steam/steam_wine/Dockerfile new file mode 100644 index 0000000..a031afb --- /dev/null +++ b/GS/steam/steam_wine/Dockerfile @@ -0,0 +1,4 @@ +FROM eoelab.org:1027/ben0i0d/cenv:steam + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends wine && \ + apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/Program/cpp/.devcontainer/devcontainer.json b/Program/cpp/.devcontainer/devcontainer.json new file mode 100644 index 0000000..5bdeb2e --- /dev/null +++ b/Program/cpp/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "cpp", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:cpp" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Program/cpp/Dockerfile b/Program/cpp/Dockerfile new file mode 100644 index 0000000..873363f --- /dev/null +++ b/Program/cpp/Dockerfile @@ -0,0 +1,7 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends g++ gdb cmake && apt-get clean && rm -rf /var/lib/apt/lists/* + +WORKDIR "${HOME}" \ No newline at end of file diff --git a/Program/java/jdk/.devcontainer/devcontainer.json b/Program/java/jdk/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e6f7f39 --- /dev/null +++ b/Program/java/jdk/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "java", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:java" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Program/java/jdk/Dockerfile b/Program/java/jdk/Dockerfile new file mode 100644 index 0000000..5134536 --- /dev/null +++ b/Program/java/jdk/Dockerfile @@ -0,0 +1,7 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends default-jdk-headless && apt-get clean && rm -rf /var/lib/apt/lists/* + +WORKDIR "${HOME}" \ No newline at end of file diff --git a/Program/java/jre/Dockerfile b/Program/java/jre/Dockerfile new file mode 100644 index 0000000..2299d04 --- /dev/null +++ b/Program/java/jre/Dockerfile @@ -0,0 +1,5 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends default-jre-headless && apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/Program/js/.devcontainer/devcontainer.json b/Program/js/.devcontainer/devcontainer.json new file mode 100644 index 0000000..19eb9c8 --- /dev/null +++ b/Program/js/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "JS", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:js" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Program/js/Dockerfile b/Program/js/Dockerfile new file mode 100644 index 0000000..8895692 --- /dev/null +++ b/Program/js/Dockerfile @@ -0,0 +1,3 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends nodejs npm && apt-get clean && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/Program/julia/.devcontainer/devcontainer.json b/Program/julia/.devcontainer/devcontainer.json new file mode 100644 index 0000000..d3a47cb --- /dev/null +++ b/Program/julia/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "julia", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:julia" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Program/julia/Dockerfile b/Program/julia/Dockerfile new file mode 100644 index 0000000..e537f1b --- /dev/null +++ b/Program/julia/Dockerfile @@ -0,0 +1,14 @@ +FROM eoelab.org:1027/ben0i0d/cenv:python AS builder + +# install Julia packages in /opt/julias +RUN apt-get update --yes && apt-get install --yes --no-install-recommends gnupg && apt-get clean && rm -rf /var/lib/apt/lists/* && \ + pip --no-cache-dir install jill && jill install --confirm + +FROM eoelab.org:1027/ben0i0d/cenv:base + +COPY --from=builder /opt/julias/ /opt/julias/ + +ENV JULIA_PKG_SERVER=https://mirrors.ustc.edu.cn/julia \ + JULIA_NUM_THREADS=8 + +RUN ln -s "`find /opt/julias -name 'bin'`/julia" /usr/local/bin/julia \ No newline at end of file diff --git a/Program/python/.devcontainer/devcontainer.json b/Program/python/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0c3a227 --- /dev/null +++ b/Program/python/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "python", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:python" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Program/python/Dockerfile b/Program/python/Dockerfile new file mode 100644 index 0000000..af1760f --- /dev/null +++ b/Program/python/Dockerfile @@ -0,0 +1,12 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +ENV PATH="/opt/base/bin:${PATH}" + +# install python +RUN apt-get update --yes && apt-get install --yes --no-install-recommends python3-venv && apt-get clean && rm -rf /var/lib/apt/lists/* && \ + python3 -m venv /opt/base && \ + echo '[global]\nindex-url = https://mirrors.bfsu.edu.cn/pypi/web/simple' > /etc/pip.conf + +WORKDIR "${HOME}" diff --git a/Program/r/.devcontainer/devcontainer.json b/Program/r/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e88544a --- /dev/null +++ b/Program/r/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "r", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:r" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/Program/r/Dockerfile b/Program/r/Dockerfile new file mode 100644 index 0000000..c7dbd1c --- /dev/null +++ b/Program/r/Dockerfile @@ -0,0 +1,8 @@ +FROM eoelab.org:1027/ben0i0d/cenv:base + +USER root + +# INSTALL R+IRkernel +RUN apt-get update && apt-get install --yes --no-install-recommends r-base&& apt-get clean && rm -rf /var/lib/apt/lists/* && \ +# set cran mirror + echo 'options(repos=c(USTC="https://mirrors.ustc.edu.cn/CRAN/"))' >> /usr/lib/R/library/base/R/Rprofile diff --git a/README.md b/README.md new file mode 100644 index 0000000..f13e8e0 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +# Cenv +English | [中文](README_CN.md) + +**THIS doc for non-CN USER** + +**dockerhub: https://hub.docker.com/r/ben0i0d/cenv** + +**Our Gitea: https://eoelab.org:1027/ben0i0d/cenv** + +## Prerequisites +* CPU : nothing to do +* ROCM : amdgpu-dkms -> Docker containers share the kernel with the host OS. Therefore, the ROCm kernel-mode driver (amdgpu-dkms) must be installed on the host. +* CUDA : nvidia-container-toolkit/nvidia-docker2 + +## Platform +* OS : debian 12 / ubuntu 24.04(ROCM only) +* ARCH : x86_64 + +## Version +* cuda: 12.4 +* rocm: 6.2.4 + +## Usage +### container +* CPU just `docker run -it` +* ROCM `docker run --device /dev/kfd --device /dev/dri --security-opt seccomp=unconfined IMAGE` +### devcontainer(VScode) +`cp -r .devcontainer WORKSDIR` + +## Image dependencies +```mermaid +graph LR + +CPU-->B{Base} +CUDA-->B +ROCM-->B + +B-->P{PROGRAM} +P-->PA(Cpp) +P-->PB(Java) +PB-->PBA(Jdk) +PB-->PBB(Jre) +P-->PC(Js) +P-->PD(Julia) +P-->PE(Python) +P-->PF(R) + +B-->G{GameServer}-->GA{MC}-->GAA(JAVA) +GAA-->GAAA(JRE_8) +GAA-->GAAB(JRE_11) +GAA-->GAAC(JRE_17) +GAA-->GAAD(JRE_21) + +G-->GB{MCSM}-->GBA(Web) +GB-->GBB(Daemon) + +G-->GC(steam)-->GCA(steam_wine) +``` +## Upstream +* NVIDIA: https://gitlab.com/nvidia/container-images/cuda +* ROCM: https://github.com/ROCm/ROCm-docker + +## Mirror source +* debian ustc:https://mirrors.ustc.edu.cn/help/debian.html +* ubuntu ustc:https://mirrors.ustc.edu.cn/help/ubuntu.html \ No newline at end of file diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000..f387016 --- /dev/null +++ b/README_CN.md @@ -0,0 +1,66 @@ +# gpu +English | [中文](README_CN.md) + +**为中国用户的文档** + +**dockerhub: https://hub.docker.com/r/ben0i0d/gpu** + +**Gitea: https://eoelab.org:1027/ben0i0d/gpu** + +## 先决条件 +* CPU : nothing to do +* ROCM : amdgpu-dkms -> Docker 容器与主机操作系统共享内核。因此,主机上必须安装 ROCm 内核模式驱动程序 ( amdgpu-dkms ) +* CUDA : nvidia-container-toolkit/nvidia-docker2 + +## 目标平台 +* OS : debian 12 / ubuntu 24.04(只有ROCM) +* ARCH : x86_64 + +## 版本 +* cuda: 12.4 +* rocm: 6.2.4 + +## 使用方法 +### container +* CPU just `docker run -it` +* ROCM `docker run --device /dev/kfd --device /dev/dri --security-opt seccomp=unconfined IMAGE` +### devcontainer(VScode) +`cp -r .devcontainer WORKSDIR` + +## 镜像依赖 +```mermaid +graph LR + +CPU-->B{Base} +CUDA-->B +ROCM-->B + +B-->P{PROGRAM} +P-->PA(Cpp) +P-->PB(Java) +PB-->PBA(Jdk) +PB-->PBB(Jre) +P-->PC(Js) +P-->PD(Julia) +P-->PE(Python) +P-->PF(R) + +B-->G{GameServer}-->GA{MC}-->GAA(JAVA) +GAA-->GAAA(JRE_8) +GAA-->GAAB(JRE_11) +GAA-->GAAC(JRE_17) +GAA-->GAAD(JRE_21) + +G-->GB{MCSM}-->GBA(Web) +GB-->GBB(Daemon) + +G-->GC(steam)-->GCA(steam_wine) +``` + +## 镜像源 +* debian ustc:https://mirrors.ustc.edu.cn/help/debian.html +* ubuntu ustc:https://mirrors.ustc.edu.cn/help/ubuntu.html + +## 上游 +* NVIDIA: https://gitlab.com/nvidia/container-images/cuda +* ROCM: https://github.com/ROCm/ROCm-docker diff --git a/base/cpu/.devcontainer/devcontainer.json b/base/cpu/.devcontainer/devcontainer.json new file mode 100644 index 0000000..eb233ab --- /dev/null +++ b/base/cpu/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "base", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "docker.io/ben0i0d/denv:base" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/base/cpu/Dockerfile b/base/cpu/Dockerfile new file mode 100644 index 0000000..bd34492 --- /dev/null +++ b/base/cpu/Dockerfile @@ -0,0 +1,8 @@ +FROM debian:bookworm-slim + +USER root + +# Configure environment +ENV DEBIAN_FRONTEND=noninteractive + +RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources \ No newline at end of file diff --git a/base/cuda/base/Dockerfile b/base/cuda/base/Dockerfile new file mode 100644 index 0000000..cc81edc --- /dev/null +++ b/base/cuda/base/Dockerfile @@ -0,0 +1,27 @@ +FROM debian:bookworm-slim + +ARG DEBIAN_MIRROR + +ARG NV_CUDA_CUDART_VERSION=12.4.127-1 \ + NV_CUDA_COMPAT_PACKAGE=cuda-compat-12-4 \ + NVARCH=x86_64 + +# nvidia-container-runtime +ENV NVIDIA_VISIBLE_DEVICES=all \ + NVIDIA_DRIVER_CAPABILITIES=compute,utility \ + 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 && \ + 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 + apt-get update && apt-get install -y --no-install-recommends \ + cuda-cudart-12-4=${NV_CUDA_CUDART_VERSION} \ + ${NV_CUDA_COMPAT_PACKAGE} && \ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ +# Required for nvidia-docker v1 + echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ + echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf + diff --git a/base/cuda/devel/Dockerfile b/base/cuda/devel/Dockerfile new file mode 100644 index 0000000..3fd3ef0 --- /dev/null +++ b/base/cuda/devel/Dockerfile @@ -0,0 +1,31 @@ +FROM eoelab.org:1027/ben0i0d/cenv:cuda_runtime + +ARG NV_CUDA_LIB_VERSION=12.4.1-1 \ + NV_CUDA_CUDART_DEV_VERSION=12.4.127-1 \ + NV_NVML_DEV_VERSION=12.4.127-1 \ + NV_LIBCUSPARSE_DEV_VERSION=12.3.1.170-1 \ + NV_LIBNPP_DEV_PACKAGE="libnpp-dev-12-4=12.2.5.30-1" \ + NV_LIBCUBLAS_DEV_PACKAGE_NAME=libcublas-dev-12-4 \ + NV_LIBCUBLAS_DEV_PACKAGE="libcublas-dev-12-4=12.4.5.8-1" \ + NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE="cuda-nsight-compute-12-4=12.4.1-1" \ + NV_NVPROF_DEV_PACKAGE="cuda-nvprof-12-4=12.4.127-1" \ + NV_LIBNCCL_DEV_PACKAGE_NAME=libnccl-dev \ + NV_LIBNCCL_DEV_PACKAGE="libnccl-dev=2.21.5-1+cuda12.4" + +ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LIBRARY_PATH + +RUN apt-get update && apt-get install -y --no-install-recommends \ + cuda-cudart-dev-12-4=${NV_CUDA_CUDART_DEV_VERSION} \ + cuda-command-line-tools-12-4=${NV_CUDA_LIB_VERSION} \ + cuda-minimal-build-12-4=${NV_CUDA_LIB_VERSION} \ + cuda-libraries-dev-12-4=${NV_CUDA_LIB_VERSION} \ + cuda-nvml-dev-12-4=${NV_NVML_DEV_VERSION} \ + ${NV_NVPROF_DEV_PACKAGE} \ + ${NV_LIBNPP_DEV_PACKAGE} \ + libcusparse-dev-12-4=${NV_LIBCUSPARSE_DEV_VERSION} \ + ${NV_LIBCUBLAS_DEV_PACKAGE} \ + ${NV_LIBNCCL_DEV_PACKAGE} \ + ${NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE} &&\ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ +# Keep apt from auto upgrading the cublas and nccl packages. See https://gitlab.com/nvidia/container-images/cuda/-/issues/88 + apt-mark hold ${NV_LIBCUBLAS_DEV_PACKAGE_NAME} ${NV_LIBNCCL_DEV_PACKAGE_NAME} diff --git a/base/cuda/runtime/Dockerfile b/base/cuda/runtime/Dockerfile new file mode 100644 index 0000000..cba5cfa --- /dev/null +++ b/base/cuda/runtime/Dockerfile @@ -0,0 +1,27 @@ +FROM eoelab.org:1027/ben0i0d/cenv:cuda_base + +ARG NV_CUDA_LIB_VERSION=12.4.1-1 \ + NV_NVTX_VERSION=12.4.127-1 \ + NV_LIBNPP_PACKAGE="libnpp-12-4=12.2.5.30-1" \ + NV_LIBCUSPARSE_VERSION=12.3.1.170-1 \ + NV_LIBCUBLAS_PACKAGE_NAME=libcublas-12-4 \ + NV_LIBCUBLAS_PACKAGE="libcublas-12-4=12.4.5.8-1" \ + NV_LIBNCCL_PACKAGE_NAME=libnccl2 \ + NV_LIBNCCL_PACKAGE="libnccl2=2.21.5-1+cuda12.4" + +# Add entrypoint items +COPY entrypoint.d/ /opt/nvidia/entrypoint.d/ +COPY nvidia_entrypoint.sh /opt/nvidia/ + +RUN apt-get update && apt-get install -y --no-install-recommends \ + cuda-libraries-12-4=${NV_CUDA_LIB_VERSION} \ + ${NV_LIBNPP_PACKAGE} \ + cuda-nvtx-12-4=${NV_NVTX_VERSION} \ + libcusparse-12-4=${NV_LIBCUSPARSE_VERSION} \ + ${NV_LIBCUBLAS_PACKAGE} \ + ${NV_LIBNCCL_PACKAGE} && \ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + # Keep apt from auto upgrading the cublas and nccl packages. See https://gitlab.com/nvidia/container-images/cuda/-/issues/88 + apt-mark hold ${NV_LIBCUBLAS_PACKAGE_NAME} ${NV_LIBNCCL_PACKAGE_NAME} + +ENTRYPOINT ["/opt/nvidia/nvidia_entrypoint.sh"] \ No newline at end of file diff --git a/base/cuda/runtime/entrypoint.d/10-banner.sh b/base/cuda/runtime/entrypoint.d/10-banner.sh new file mode 100644 index 0000000..704c477 --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/10-banner.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +_banner_file="${BASH_SOURCE[0]/%.sh/.txt}" + +# 10-banner.sh allows itself to be skipped if there exists a +# 10-banner.txt, which will be cat'd next alphabetically +if [[ ! -f "${_banner_file}" && -n "${NVIDIA_PRODUCT_NAME}" ]]; then + echo + print_banner_text "=" "${NVIDIA_PRODUCT_NAME}" +fi diff --git a/base/cuda/runtime/entrypoint.d/12-banner.sh b/base/cuda/runtime/entrypoint.d/12-banner.sh new file mode 100644 index 0000000..878be43 --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/12-banner.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +_prodname_uc=$(echo "${NVIDIA_PRODUCT_NAME}" | tr [:lower:] [:upper:] | sed 's/ /_/g' | sed 's/^NVIDIA_//') # Product name +_compver="${_prodname_uc}_VERSION" # Upstream component version variable name + +echo +[ -n "${!_compver}" ] && echo "${NVIDIA_PRODUCT_NAME} Version ${!_compver}" diff --git a/base/cuda/runtime/entrypoint.d/15-container-copyright.txt b/base/cuda/runtime/entrypoint.d/15-container-copyright.txt new file mode 100644 index 0000000..33a5751 --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/15-container-copyright.txt @@ -0,0 +1,2 @@ + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. diff --git a/base/cuda/runtime/entrypoint.d/30-container-license.txt b/base/cuda/runtime/entrypoint.d/30-container-license.txt new file mode 100644 index 0000000..0c61b70 --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/30-container-license.txt @@ -0,0 +1,6 @@ + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. diff --git a/base/cuda/runtime/entrypoint.d/50-gpu-driver-check.sh b/base/cuda/runtime/entrypoint.d/50-gpu-driver-check.sh new file mode 100644 index 0000000..86ba39e --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/50-gpu-driver-check.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +# Check if libcuda.so.1 -- the CUDA driver -- is present in the ld.so cache or in LD_LIBRARY_PATH +_LIBCUDA_FROM_LD_CACHE=$(ldconfig -p | grep libcuda.so.1) +_LIBCUDA_FROM_LD_LIBRARY_PATH=$( ( IFS=: ; for i in ${LD_LIBRARY_PATH}; do ls $i/libcuda.so.1 2>/dev/null | grep -v compat; done) ) +_LIBCUDA_FOUND="${_LIBCUDA_FROM_LD_CACHE}${_LIBCUDA_FROM_LD_LIBRARY_PATH}" + +# Check if /dev/nvidiactl (like on Linux) or /dev/dxg (like on WSL2) or /dev/nvgpu (like on Tegra) is present +_DRIVER_FOUND=$(ls /dev/nvidiactl /dev/dxg /dev/nvgpu 2>/dev/null) + +# If either is not true, then GPU functionality won't be usable. +if [[ -z "${_LIBCUDA_FOUND}" || -z "${_DRIVER_FOUND}" ]]; then + echo + echo "WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available." + echo " Use the NVIDIA Container Toolkit to start this container with GPU support; see" + echo " https://docs.nvidia.com/datacenter/cloud-native/ ." + export NVIDIA_CPU_ONLY=1 +fi diff --git a/base/cuda/runtime/entrypoint.d/80-internal-image.sh b/base/cuda/runtime/entrypoint.d/80-internal-image.sh new file mode 100644 index 0000000..d6c6906 --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/80-internal-image.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +internal_only_deprecation_notice() { + echo + print_banner_text "*" "PRIVATE IMAGE" + echo "This image is PRIVATE." + echo "FOR INTERNAL USE ONLY" + echo "DO NOT ship to external customers!" +} + +[ -n "${NVIDIA_CUDA_INTERNAL}" ] && internal_only_deprecation_notice diff --git a/base/cuda/runtime/entrypoint.d/90-deprecated-image.sh b/base/cuda/runtime/entrypoint.d/90-deprecated-image.sh new file mode 100644 index 0000000..3bd1c52 --- /dev/null +++ b/base/cuda/runtime/entrypoint.d/90-deprecated-image.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +show_deprecation_notice() { + echo + print_banner_text "*" "DEPRECATION NOTICE!" + echo "THIS IMAGE IS DEPRECATED and is scheduled for DELETION." + echo " https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/support-policy.md" +} + +[ -n "${NVIDIA_CUDA_END_OF_LIFE}" ] && show_deprecation_notice diff --git a/base/cuda/runtime/nvidia_entrypoint.sh b/base/cuda/runtime/nvidia_entrypoint.sh new file mode 100755 index 0000000..a177841 --- /dev/null +++ b/base/cuda/runtime/nvidia_entrypoint.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of NVIDIA CORPORATION nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Gather parts in alpha order +shopt -s nullglob extglob +_SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +declare -a _PARTS=( "${_SCRIPT_DIR}/entrypoint.d"/*@(.txt|.sh) ) +shopt -u nullglob extglob + +print_repeats() { + local -r char="$1" count="$2" + local i + for ((i=1; i<=$count; i++)); do echo -n "$char"; done + echo +} + +print_banner_text() { + # $1: Banner char + # $2: Text + local banner_char=$1 + local -r text="$2" + local pad="${banner_char}${banner_char}" + print_repeats "${banner_char}" $((${#text} + 6)) + echo "${pad} ${text} ${pad}" + print_repeats "${banner_char}" $((${#text} + 6)) +} + +# Execute the entrypoint parts +for _file in "${_PARTS[@]}"; do + case "${_file}" in + *.txt) cat "${_file}";; + *.sh) source "${_file}";; + esac +done + +echo + +# This script can either be a wrapper around arbitrary command lines, +# or it will simply exec bash if no arguments were given +if [[ $# -eq 0 ]]; then + exec "/bin/bash" +else + exec "$@" +fi diff --git a/base/rocm/.devcontainer/devcontainer.json b/base/rocm/.devcontainer/devcontainer.json new file mode 100644 index 0000000..2861596 --- /dev/null +++ b/base/rocm/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "rocm", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "eoelab.org:1027/ben0i0d/gpu:rocm", + "runArgs": ["--device","/dev/kfd", "--device","/dev/dri", "--security-opt", "seccomp=unconfined", "--shm-size","4G"] + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/base/rocm/Dockerfile b/base/rocm/Dockerfile new file mode 100644 index 0000000..4e1046d --- /dev/null +++ b/base/rocm/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:24.04 + +ARG UBUNTU_MIRROR + +ARG VERSION=6.2.4 + +ENV PATH="${PATH}:/opt/rocm/bin" \ + DEBIAN_FRONTEND=noninteractive + + # 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 && \ + # Install ROCm-ml-libraries + apt-get update && apt-get install -y --no-install-recommends 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 +