diff --git a/OS/ubuntu-cuda/24.04/Dockerfile b/OS/ubuntu-cuda/24.04/Dockerfile new file mode 100644 index 00000000..c88e92cd --- /dev/null +++ b/OS/ubuntu-cuda/24.04/Dockerfile @@ -0,0 +1,56 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +COPY /script/startup.sh /usr/start/startup.sh + +RUN apt update && \ + apt install -y \ + net-tools \ + iproute2 \ + iputils-ping \ + curl \ + sudo \ + wget \ + netcat-openbsd \ + vim \ + openssl \ + make \ + git && \ + mkdir -p /usr/start && \ + apt clean + +RUN chmod +x /usr/start/startup.sh && \ + apt-get update && \ + apt-get install -y \ + dumb-init \ + openssh-client \ + openssh-server && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + mkdir -p /run/sshd && \ + chmod 755 /run/sshd && \ + echo 'AllowTcpForwarding yes' >> /etc/ssh/sshd_config && \ + echo 'GatewayPorts yes' >> /etc/ssh/sshd_config && \ + echo 'X11Forwarding yes' >> /etc/ssh/sshd_config && \ + echo 'Port 22' >> /etc/ssh/sshd_config && \ + useradd -m -s /bin/bash devbox && \ + usermod -aG sudo devbox && \ + echo 'devbox ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ + rm -rf /tmp/* && \ + mkdir -p /home/devbox/.ssh && \ + chown -R devbox:devbox /home/devbox/.ssh && \ + chmod -R 770 /home/devbox/.ssh + +USER devbox +COPY /OS/debian-ssh/project /home/devbox/project +RUN sudo chown -R devbox:devbox /home/devbox/project && \ + sudo chmod -R 777 /home/devbox/project && \ + sudo chmod -R +x /home/devbox/project/entrypoint.sh + + +USER root + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] +CMD ["sudo", "-E", "/usr/start/startup.sh"] + +WORKDIR /home/devbox/project +EXPOSE 22 \ No newline at end of file diff --git a/OS/ubuntu-cuda/project/.vscode/extensions.json b/OS/ubuntu-cuda/project/.vscode/extensions.json new file mode 100644 index 00000000..87ebf2ad --- /dev/null +++ b/OS/ubuntu-cuda/project/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "pomdtr.excalidraw-editor", + "editorconfig.editorconfig", + "lokalise.i18n-ally" + ] +} \ No newline at end of file diff --git a/OS/ubuntu-cuda/project/entrypoint.sh b/OS/ubuntu-cuda/project/entrypoint.sh new file mode 100644 index 00000000..5fddb409 --- /dev/null +++ b/OS/ubuntu-cuda/project/entrypoint.sh @@ -0,0 +1 @@ +./hello.sh \ No newline at end of file diff --git a/OS/ubuntu-cuda/project/hello.sh b/OS/ubuntu-cuda/project/hello.sh new file mode 100755 index 00000000..2b2fb28f --- /dev/null +++ b/OS/ubuntu-cuda/project/hello.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +while :; do + { echo -ne "HTTP/1.1 200 OK\r\nContent-Length: $(echo -n "Hello, World!")\r\n\r\nHello, World!"; } | nc -l -p 8080 -q 1 +done diff --git a/OS/ubuntu-cuda/sources.list b/OS/ubuntu-cuda/sources.list new file mode 100644 index 00000000..2abfa823 --- /dev/null +++ b/OS/ubuntu-cuda/sources.list @@ -0,0 +1,8 @@ +deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse +deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse +deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse +deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse \ No newline at end of file diff --git a/OS/ubuntu-cuda/update_cn_dockerfile.sh b/OS/ubuntu-cuda/update_cn_dockerfile.sh new file mode 100755 index 00000000..e8cbadc6 --- /dev/null +++ b/OS/ubuntu-cuda/update_cn_dockerfile.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +DOCKERFILE=$1 +echo "DOCKERFILE: $DOCKERFILE" +TMP_DOCKERFILE="${DOCKERFILE}tmp" +cp $DOCKERFILE $TMP_DOCKERFILE + +sed -i '$i\ +COPY /OS/ubuntu/sources.list /etc/apt/sources.list' "$TMP_DOCKERFILE" \ No newline at end of file diff --git a/configs/name.txt b/configs/name.txt index 2756655b..9061b792 100644 --- a/configs/name.txt +++ b/configs/name.txt @@ -37,3 +37,4 @@ c=c quarkus=quarkus nginx=nginx sealaf=Laf +ubuntu-cuda=ubuntu-cuda diff --git a/configs/port.txt b/configs/port.txt index e0f0f878..7bd04bf6 100644 --- a/configs/port.txt +++ b/configs/port.txt @@ -37,3 +37,4 @@ c=8080 quarkus=8080 nginx=80 sealaf=2342 +ubuntu-cuda=8080 diff --git a/script/patch_devbox.sh b/script/patch_devbox.sh index a8e89309..02c16793 100644 --- a/script/patch_devbox.sh +++ b/script/patch_devbox.sh @@ -22,7 +22,7 @@ for line in "${runtime_lines[@]:1}"; do read class version < <(kubectl get runtime $class -n devbox-system -o json | jq -r '[.spec.classRef, .spec.version] | @tsv') id =jq '.["$class"-"$version"]' output.json read templateID < <(kubectl get devbox $name -n $namespace -o json | jq -r '.spec.templateID') - kubectl patch devbox $name -n $namespace --type='json' -p='[{"op": "add", "path": "/spec/templateID", "value": "$id"}]' + kubectl patch devbox $name -n $namespace --type='json' -p='[{"op": "replace", "path": "/spec/templateID", "value": "$id"}]' fi done