diff options
| author | hc <hc@email.ch> | 2025-05-31 23:44:40 +0800 |
|---|---|---|
| committer | hc <hc@email.ch> | 2025-05-31 23:44:40 +0800 |
| commit | d6eb567da3e6d2e64ebf22adf1fc6d21c47090f8 (patch) | |
| tree | 14c15830a8014001d5cc587b5b4d4454c880396e /docker_build | |
| parent | ce511f49438761549e904d6e972b8c0635306ff9 (diff) | |
hehe
Diffstat (limited to 'docker_build')
| -rw-r--r-- | docker_build/Dockerfile | 4 | ||||
| -rw-r--r-- | docker_build/Dockerfile.gpu | 40 | ||||
| -rw-r--r-- | docker_build/ssh-keys/macm4-resident.pub | 1 |
3 files changed, 43 insertions, 2 deletions
diff --git a/docker_build/Dockerfile b/docker_build/Dockerfile index 5df57d2..16f74d6 100644 --- a/docker_build/Dockerfile +++ b/docker_build/Dockerfile | |||
| @@ -19,8 +19,8 @@ RUN mkdir -p /var/run/sshd && \ | |||
| 19 | RUN mkdir -p /root/.ssh && \ | 19 | RUN mkdir -p /root/.ssh && \ |
| 20 | chmod 700 /root/.ssh && \ | 20 | chmod 700 /root/.ssh && \ |
| 21 | usermod -s /bin/bash root | 21 | usermod -s /bin/bash root |
| 22 | # Copy SSH public keys from ssh-keys directory into the image | 22 | # Copy SSH public keys from docker_build/ssh-keys directory into the image |
| 23 | COPY ssh-keys/*.pub /tmp/ssh-keys/ | 23 | COPY docker_build/ssh-keys/*.pub /tmp/ssh-keys/ |
| 24 | RUN cat /tmp/ssh-keys/*.pub > /root/.ssh/authorized_keys && \ | 24 | RUN cat /tmp/ssh-keys/*.pub > /root/.ssh/authorized_keys && \ |
| 25 | chmod 600 /root/.ssh/authorized_keys && \ | 25 | chmod 600 /root/.ssh/authorized_keys && \ |
| 26 | rm -rf /tmp/ssh-keys | 26 | rm -rf /tmp/ssh-keys |
diff --git a/docker_build/Dockerfile.gpu b/docker_build/Dockerfile.gpu new file mode 100644 index 0000000..7ed08a5 --- /dev/null +++ b/docker_build/Dockerfile.gpu | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # Multi-stage build - GPU version builds on top of the base dev environment | ||
| 2 | FROM rocky_dev:latest | ||
| 3 | |||
| 4 | # Update and install GPU-specific packages | ||
| 5 | RUN dnf update -y && \ | ||
| 6 | dnf install -y kernel-headers kernel-devel pciutils && \ | ||
| 7 | dnf clean all | ||
| 8 | |||
| 9 | # Install NVIDIA container toolkit dependencies | ||
| 10 | RUN dnf config-manager --add-repo https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo && \ | ||
| 11 | dnf install -y nvidia-container-toolkit && \ | ||
| 12 | dnf clean all | ||
| 13 | |||
| 14 | # Set environment variables for NVIDIA | ||
| 15 | ENV NVIDIA_VISIBLE_DEVICES=all | ||
| 16 | ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility | ||
| 17 | |||
| 18 | # Add GPU test script | ||
| 19 | RUN echo '#!/bin/bash' > /usr/local/bin/gpu-test.sh && \ | ||
| 20 | echo 'echo "=== System Information ==="' >> /usr/local/bin/gpu-test.sh && \ | ||
| 21 | echo 'cat /etc/rocky-release' >> /usr/local/bin/gpu-test.sh && \ | ||
| 22 | echo 'echo' >> /usr/local/bin/gpu-test.sh && \ | ||
| 23 | echo 'echo "=== PCI Devices (GPUs) ==="' >> /usr/local/bin/gpu-test.sh && \ | ||
| 24 | echo 'lspci | grep -i nvidia' >> /usr/local/bin/gpu-test.sh && \ | ||
| 25 | echo 'echo' >> /usr/local/bin/gpu-test.sh && \ | ||
| 26 | echo 'echo "=== NVIDIA SMI ==="' >> /usr/local/bin/gpu-test.sh && \ | ||
| 27 | echo 'if command -v nvidia-smi &> /dev/null; then' >> /usr/local/bin/gpu-test.sh && \ | ||
| 28 | echo ' nvidia-smi' >> /usr/local/bin/gpu-test.sh && \ | ||
| 29 | echo 'else' >> /usr/local/bin/gpu-test.sh && \ | ||
| 30 | echo ' echo "nvidia-smi not found. GPU might not be accessible inside container."' >> /usr/local/bin/gpu-test.sh && \ | ||
| 31 | echo 'fi' >> /usr/local/bin/gpu-test.sh && \ | ||
| 32 | chmod +x /usr/local/bin/gpu-test.sh | ||
| 33 | |||
| 34 | # Create workspace directory for GPU workloads | ||
| 35 | RUN mkdir -p /workspace | ||
| 36 | |||
| 37 | # Keep the same working directory and CMD from base image | ||
| 38 | WORKDIR /root | ||
| 39 | EXPOSE 22 | ||
| 40 | CMD ["/usr/sbin/sshd", "-D", "-e"] \ No newline at end of file | ||
diff --git a/docker_build/ssh-keys/macm4-resident.pub b/docker_build/ssh-keys/macm4-resident.pub new file mode 100644 index 0000000..fbccb4f --- /dev/null +++ b/docker_build/ssh-keys/macm4-resident.pub | |||
| @@ -0,0 +1 @@ | |||
| sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFdHP8n64jOV6Ok7U9TDnGW+LUkXP6V7cvXH6xqN0zcNAAAAEnNzaDptYWNtNC1yZXNpZGVudA== ssh:macm4-resident | |||
