summaryrefslogtreecommitdiff
path: root/containers/docker_build
diff options
context:
space:
mode:
authorhc <hc@email.ch>2025-06-25 19:40:43 +0800
committerhc <hc@email.ch>2025-06-25 19:40:43 +0800
commitccdde5f4424836fc8e9cc98c204510fed9612e70 (patch)
treedf1500f00b2f0b32b8729732454585c318b51110 /containers/docker_build
parentd6eb567da3e6d2e64ebf22adf1fc6d21c47090f8 (diff)
merged setup and contaienrs
Diffstat (limited to 'containers/docker_build')
-rw-r--r--containers/docker_build/Dockerfile61
-rw-r--r--containers/docker_build/Dockerfile.gpu40
-rw-r--r--containers/docker_build/ssh-keys/macm4-resident.pub1
-rw-r--r--containers/docker_build/vimrc77
4 files changed, 179 insertions, 0 deletions
diff --git a/containers/docker_build/Dockerfile b/containers/docker_build/Dockerfile
new file mode 100644
index 0000000..16f74d6
--- /dev/null
+++ b/containers/docker_build/Dockerfile
@@ -0,0 +1,61 @@
+FROM rockylinux:9
+
+# Install required packages, resolving curl conflict
+RUN dnf install -y epel-release
+RUN dnf install -y --allowerasing openssh-server sudo procps-ng \
+ gcc gcc-c++ make cmake pkg-config openssl-devel libicu-devel perl python3-devel \
+ nc openssl bat autossh tmux htop tar bmon gzip tree wget \
+ nano vim unzip net-tools git python3 python3-pip make wireguard-tools usbutils yum xclip \
+ && dnf clean all
+
+# Configure SSH
+RUN mkdir -p /var/run/sshd && \
+ ssh-keygen -A && \
+ sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config && \
+ sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
+ sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && \
+ echo "AllowAgentForwarding yes" >> /etc/ssh/sshd_config
+# Setup SSH directory for root and ensure root has valid shell
+RUN mkdir -p /root/.ssh && \
+ chmod 700 /root/.ssh && \
+ usermod -s /bin/bash root
+# Copy SSH public keys from docker_build/ssh-keys directory into the image
+COPY docker_build/ssh-keys/*.pub /tmp/ssh-keys/
+RUN cat /tmp/ssh-keys/*.pub > /root/.ssh/authorized_keys && \
+ chmod 600 /root/.ssh/authorized_keys && \
+ rm -rf /tmp/ssh-keys
+
+# Configure vim
+COPY docker_build/vimrc /etc/vimrc
+
+# Configure bash prompt and colors
+RUN echo 'LS_COLORS=$LS_COLORS:"di=38;5;135:ex=00;32:" ; export LS_COLORS' >> /etc/bashrc && \
+ echo 'PS1="[\[\033[01;32m\]\u\[\033[00m\]@\h \[\033[38;5;135m\]\W\[\033[00m\]]\$ "' >> /etc/bashrc && \
+ echo 'export PATH=$PATH:/root/.cargo/bin' >> /root/.bashrc
+
+# Install Rust and tools for root
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
+ echo '[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"' >> ~/.bashrc && \
+ source "$HOME/.cargo/env" && \
+ cargo install cargo-clone-crate cargo-edit cargo-info evcxr_jupyter bacon du-dust
+
+# Install Node.js via nvm and claude-code
+RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
+ export NVM_DIR="$HOME/.nvm" && \
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
+ nvm install 22 && \
+ npm install -g @anthropic-ai/claude-code
+
+# Add nvm to bashrc for future sessions
+RUN echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
+ echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc && \
+ echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> ~/.bashrc
+
+# Set working directory
+WORKDIR /root
+
+# Expose SSH port
+EXPOSE 22
+
+# Start SSH daemon
+CMD ["/usr/sbin/sshd", "-D", "-e"]
diff --git a/containers/docker_build/Dockerfile.gpu b/containers/docker_build/Dockerfile.gpu
new file mode 100644
index 0000000..7ed08a5
--- /dev/null
+++ b/containers/docker_build/Dockerfile.gpu
@@ -0,0 +1,40 @@
+# Multi-stage build - GPU version builds on top of the base dev environment
+FROM rocky_dev:latest
+
+# Update and install GPU-specific packages
+RUN dnf update -y && \
+ dnf install -y kernel-headers kernel-devel pciutils && \
+ dnf clean all
+
+# Install NVIDIA container toolkit dependencies
+RUN dnf config-manager --add-repo https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo && \
+ dnf install -y nvidia-container-toolkit && \
+ dnf clean all
+
+# Set environment variables for NVIDIA
+ENV NVIDIA_VISIBLE_DEVICES=all
+ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
+
+# Add GPU test script
+RUN echo '#!/bin/bash' > /usr/local/bin/gpu-test.sh && \
+ echo 'echo "=== System Information ==="' >> /usr/local/bin/gpu-test.sh && \
+ echo 'cat /etc/rocky-release' >> /usr/local/bin/gpu-test.sh && \
+ echo 'echo' >> /usr/local/bin/gpu-test.sh && \
+ echo 'echo "=== PCI Devices (GPUs) ==="' >> /usr/local/bin/gpu-test.sh && \
+ echo 'lspci | grep -i nvidia' >> /usr/local/bin/gpu-test.sh && \
+ echo 'echo' >> /usr/local/bin/gpu-test.sh && \
+ echo 'echo "=== NVIDIA SMI ==="' >> /usr/local/bin/gpu-test.sh && \
+ echo 'if command -v nvidia-smi &> /dev/null; then' >> /usr/local/bin/gpu-test.sh && \
+ echo ' nvidia-smi' >> /usr/local/bin/gpu-test.sh && \
+ echo 'else' >> /usr/local/bin/gpu-test.sh && \
+ echo ' echo "nvidia-smi not found. GPU might not be accessible inside container."' >> /usr/local/bin/gpu-test.sh && \
+ echo 'fi' >> /usr/local/bin/gpu-test.sh && \
+ chmod +x /usr/local/bin/gpu-test.sh
+
+# Create workspace directory for GPU workloads
+RUN mkdir -p /workspace
+
+# Keep the same working directory and CMD from base image
+WORKDIR /root
+EXPOSE 22
+CMD ["/usr/sbin/sshd", "-D", "-e"] \ No newline at end of file
diff --git a/containers/docker_build/ssh-keys/macm4-resident.pub b/containers/docker_build/ssh-keys/macm4-resident.pub
new file mode 100644
index 0000000..fbccb4f
--- /dev/null
+++ b/containers/docker_build/ssh-keys/macm4-resident.pub
@@ -0,0 +1 @@
+sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFdHP8n64jOV6Ok7U9TDnGW+LUkXP6V7cvXH6xqN0zcNAAAAEnNzaDptYWNtNC1yZXNpZGVudA== ssh:macm4-resident
diff --git a/containers/docker_build/vimrc b/containers/docker_build/vimrc
new file mode 100644
index 0000000..36583bc
--- /dev/null
+++ b/containers/docker_build/vimrc
@@ -0,0 +1,77 @@
+" Basic vim configuration for development environment
+
+" Enable syntax highlighting
+syntax on
+
+" Enable line numbers
+set number
+
+" Enable relative line numbers for easier navigation
+set relativenumber
+
+" Set tab width to 4 spaces
+set tabstop=4
+set shiftwidth=4
+set expandtab
+
+" Enable auto-indentation
+set autoindent
+set smartindent
+
+" Enable incremental search
+set incsearch
+
+" Highlight search results
+set hlsearch
+
+" Case-insensitive search unless uppercase is used
+set ignorecase
+set smartcase
+
+" Show matching brackets
+set showmatch
+
+" Enable mouse support
+set mouse=a
+
+" Set backspace behavior
+set backspace=indent,eol,start
+
+" Show current line and column
+set ruler
+
+" Enable file type detection
+filetype on
+filetype plugin on
+filetype indent on
+
+" Set color scheme (if available)
+colorscheme default
+
+" Enable visual bell instead of beep
+set visualbell
+
+" Set encoding
+set encoding=utf-8
+
+" Show command in status line
+set showcmd
+
+" Enable wildmenu for command completion
+set wildmenu
+
+" Set status line
+set laststatus=2
+set statusline=%F%m%r%h%w\ [%l,%c]\ [%L\ lines]
+
+" Rust specific settings
+autocmd FileType rust setlocal tabstop=4 shiftwidth=4 expandtab
+
+" Python specific settings
+autocmd FileType python setlocal tabstop=4 shiftwidth=4 expandtab
+
+" JavaScript/TypeScript settings
+autocmd FileType javascript,typescript setlocal tabstop=2 shiftwidth=2 expandtab
+
+" YAML settings
+autocmd FileType yaml setlocal tabstop=2 shiftwidth=2 expandtab \ No newline at end of file