Skip to content

Commit

Permalink
feat:add ubuntu cuda
Browse files Browse the repository at this point in the history
  • Loading branch information
cbluebird committed Dec 9, 2024
1 parent a017a84 commit 285f026
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 1 deletion.
56 changes: 56 additions & 0 deletions OS/ubuntu-cuda/24.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions OS/ubuntu-cuda/project/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"pomdtr.excalidraw-editor",
"editorconfig.editorconfig",
"lokalise.i18n-ally"
]
}
1 change: 1 addition & 0 deletions OS/ubuntu-cuda/project/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./hello.sh
5 changes: 5 additions & 0 deletions OS/ubuntu-cuda/project/hello.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions OS/ubuntu-cuda/sources.list
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions OS/ubuntu-cuda/update_cn_dockerfile.sh
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions configs/name.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ c=c
quarkus=quarkus
nginx=nginx
sealaf=Laf
ubuntu-cuda=ubuntu-cuda
1 change: 1 addition & 0 deletions configs/port.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ c=8080
quarkus=8080
nginx=80
sealaf=2342
ubuntu-cuda=8080
2 changes: 1 addition & 1 deletion script/patch_devbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 285f026

Please sign in to comment.