docker remote windows

This commit is contained in:
Dobromir Popov
2025-09-08 08:59:24 +03:00
parent a545714b34
commit c7a9a5c3a5
7 changed files with 831 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
{
"name": "RinHash Build Environment",
"dockerFile": "../Dockerfile.windows-build",
"context": "..",
"remoteUser": "root",
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"extensions": [
"ms-vscode.vscode-docker",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-containers",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"docker.host": "unix:///var/run/docker.sock",
"C_Cpp.default.compilerPath": "/usr/bin/gcc",
"C_Cpp.default.cStandard": "c11",
"C_Cpp.default.cppStandard": "c++11",
"cmake.configureOnOpen": false
},
"postCreateCommand": "apt-get update && apt-get install -y docker.io git",
"forwardPorts": [],
"shutdownAction": "stopContainer"
}

View File

@@ -23,13 +23,31 @@
"C_Cpp.default.defines": [
"HAVE_CONFIG_H"
],
"docker.host": "tcp://localhost:2375",
"docker.certificates": [],
"docker.tlsVerify": false,
"docker.machineName": "",
"docker.context": "default",
"docker.showExplorer": true,
"docker.containers.groupBy": "Image",
"docker.containers.showRunningOnly": false,
"docker.images.groupBy": "Repository",
"docker.images.showDanglingImages": false,
"docker.volumes.groupBy": "none",
"docker.networks.groupBy": "none",
"docker.contexts.groupBy": "none",
"docker.commands.build": "docker build --pull --rm -f \"${file}\" -t ${tag} \"${context}\"",
"docker.commands.run": "docker run --rm -d ${exposedPorts} ${tag}",
"docker.commands.runInteractive": "docker run --rm -it ${exposedPorts} ${tag}",
"search.exclude": {
"**/build/**": true,
"**/complete-build-output/**": true,
"**/hip-output/**": true,
"**/rocm-direct-output/**": true,
"**/*.o": true,
"**/*.exe": true
"**/*.exe": true,
"**/node_modules/**": true,
"**/.git/**": true
},
"files.exclude": {
"**/build/**": false,
@@ -39,5 +57,8 @@
},
"task.quickOpen.detail": true,
"task.quickOpen.showAll": true,
"task.saveBeforeRun": "prompt"
"task.saveBeforeRun": "prompt",
"remote.SSH.configFile": "~/.ssh/config",
"remote.SSH.showLoginTerminal": true,
"remote.SSH.useLocalServer": true
}

View File

@@ -36,6 +36,196 @@ If you're using VS Code, the project now includes pre-configured tasks for easy
- ✅ Integrated terminal output in VS Code
- ✅ One-click building from the IDE
## 🐳 Remote Docker Access Options
You don't need to SSH as root every time! Here are several ways to use Docker remotely from another machine:
### Option 1: VS Code Docker Extension (Easiest - Recommended)
```bash
# On the build machine (where Docker is running) - Quick setup:
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-remote-docker.sh
# Or manually:
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker $USER # Add user to docker group
```
**In VS Code on your local machine:**
1. Install "Docker" extension by Microsoft
2. Install "Remote-SSH" extension for SSH tunneling
3. Connect to build machine: `Ctrl+Shift+P` → "Remote-SSH: Connect to Host"
4. Use VS Code Docker extension to manage containers remotely
### Option 2: Docker Remote API (Advanced)
```bash
# On the build machine - enable Docker API over TCP:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/override.conf > /dev/null <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# Secure with TLS (recommended for production):
sudo dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --tlskey=server-key.pem -H=0.0.0.0:2376
```
**On your local machine:**
```bash
# Set Docker context to remote host
docker context create remote-build --docker "host=tcp://BUILD_MACHINE_IP:2376"
docker context use remote-build
# Now all docker commands work remotely
docker ps
docker run --rm cpuminer-windows-builder echo "Hello from remote!"
```
### Option 3: SSH Port Forwarding (Simple & Secure)
```bash
# On your local machine - forward Docker socket:
ssh -L localhost:2375:/var/run/docker.sock user@build-machine
# Or use SSH config (~/.ssh/config):
Host build-machine
HostName your-build-machine-ip
User your-username
LocalForward 2375 /var/run/docker.sock
```
**Then on your local machine:**
```bash
# Set DOCKER_HOST environment variable
export DOCKER_HOST=tcp://localhost:2375
# All docker commands now work through SSH tunnel
docker ps
docker run --rm cpuminer-windows-builder echo "Remote build ready!"
```
### Option 4: Docker Contexts (Clean Management)
```bash
# Create named context for your build machine
docker context create build-server --docker "host=ssh://user@build-machine"
# Switch between contexts easily
docker context use build-server
docker ps # Shows containers on build machine
docker context use default # Switch back to local
docker ps # Shows local containers
```
### Option 5: VS Code Dev Containers (Full Remote Development)
Create `.devcontainer/devcontainer.json`:
```json
{
"name": "RinHash Build Environment",
"dockerFile": "Dockerfile",
"context": "..",
"remoteUser": "vscode",
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"extensions": [
"ms-vscode.vscode-docker",
"ms-vscode-remote.remote-ssh"
],
"postCreateCommand": "sudo usermod -aG docker vscode"
}
```
### Option 6: Docker Desktop Remote Connection (Windows 11)
**For Windows 11 users with Docker Desktop:**
#### Windows Setup:
1. **Install Docker Desktop for Windows:**
- Download from: https://www.docker.com/products/docker-desktop
- Enable WSL 2 integration during installation
2. **Enable Docker Remote API:**
- Open Docker Desktop → Settings → General
- Enable "Expose daemon on tcp://localhost:2375 without TLS"
3. **Install OpenSSH Client:**
- Windows 11 has OpenSSH built-in
- Enable in: Settings → Apps → Optional features → OpenSSH Client
#### Windows SSH Port Forwarding:
```cmd
REM Command Prompt:
ssh -L localhost:2375:/var/run/docker.sock user@build-machine-ip
REM PowerShell:
ssh -L localhost:2375:/var/run/docker.sock user@build-machine-ip
```
#### Windows Environment Setup:
```cmd
REM Command Prompt:
set DOCKER_HOST=tcp://localhost:2375
REM PowerShell:
$env:DOCKER_HOST = "tcp://localhost:2375"
```
#### Windows Docker Contexts:
```cmd
REM Create context for remote Linux machine:
docker context create build-server --docker "host=ssh://user@build-machine-ip"
REM Switch to remote context:
docker context use build-server
REM Test remote connection:
docker run --rm cpuminer-windows-builder echo "Windows remote Docker working!"
```
### 🔒 Security Recommendations
**For Production Use:**
- ✅ Use SSH tunneling instead of exposing Docker API directly
- ✅ Enable Docker TLS verification
- ✅ Use VPN for additional security layer
- ✅ Limit Docker API access to specific IP ranges
- ✅ Regularly rotate SSH keys and certificates
**Quick Start (Most Secure):**
**For Windows 11:**
```powershell
# On build machine - automated setup:
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-remote-docker.sh
# On your Windows 11 machine - run setup script:
.\setup-remote-docker-windows.bat
# Or use PowerShell script:
.\setup-remote-docker-windows.ps1
```
**For Linux/Mac:**
```bash
# On build machine - automated setup:
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-remote-docker.sh
# On your local machine:
ssh -L localhost:2375:/var/run/docker.sock user@build-machine
export DOCKER_HOST=tcp://localhost:2375
docker run --rm cpuminer-windows-builder echo "Ready for remote builds!"
```
📖 **Detailed Instructions:**
- **Windows 11:** See [REMOTE_DOCKER_README.md](REMOTE_DOCKER_README.md) for comprehensive setup guide
- **All Platforms:** Check [BUILD_GUIDE.md](BUILD_GUIDE.md) for additional remote access options
### 1. Build GPU Library (ROCm/HIP)
```bash
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner/gpu/RinHash-hip

View File

@@ -0,0 +1,262 @@
# 🐳 Remote Docker Setup for RinHash Miner
This guide explains how to set up remote Docker access so you can build the RinHash miner from another machine without needing root SSH access every time.
## 🎯 Windows 11 Quick Start (Most Common)
If you're using **Windows 11** as your local machine, here's the fastest way to get started:
### Step 1: Install Prerequisites on Windows
1. **Install Docker Desktop:**
- Download: https://www.docker.com/products/docker-desktop
- Enable WSL 2 during installation
2. **Enable OpenSSH Client:**
- Settings → Apps → Optional features → Add "OpenSSH Client"
3. **Install VS Code:**
- Download: https://code.visualstudio.com/
- Install extensions: "Docker" and "Remote SSH"
### Step 2: Setup Remote Connection
```powershell
# PowerShell (recommended for Windows):
ssh -L localhost:2375:/var/run/docker.sock user@linux-build-machine-ip
$env:DOCKER_HOST = "tcp://localhost:2375"
# Test connection:
docker run --rm cpuminer-windows-builder echo "Remote Docker working!"
```
### Step 3: Build Remotely
```powershell
# Now you can run builds from your Windows machine:
docker run --rm -v "${PWD}:/work" -v "${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
```
### Step 4: VS Code Integration (Optional)
1. **Connect to Linux machine:**
- `Ctrl+Shift+P` → "Remote-SSH: Connect to Host"
- Enter: `ssh user@linux-build-machine-ip`
2. **Run builds from VS Code:**
- Open Command Palette: `Ctrl+Shift+P`
- Select: "Tasks: Run Task"
- Choose: "Build Windows CPU Miner (Smart)"
That's it! You're now building remotely from Windows 11! 🚀
## Quick Setup (Recommended)
### On the Build Machine (where Docker runs):
```bash
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
./setup-remote-docker.sh
```
This script will:
- ✅ Add your user to the docker group
- ✅ Enable and start Docker service
- ✅ Test Docker access
- ✅ Provide connection instructions
### On Your Local Machine:
#### Option 1: SSH Port Forwarding (Most Secure)
**For Windows 11:**
```powershell
# PowerShell (recommended):
ssh -L localhost:2375:/var/run/docker.sock user@build-machine-ip
$env:DOCKER_HOST = "tcp://localhost:2375"
# Command Prompt:
ssh -L localhost:2375:/var/run/docker.sock user@build-machine-ip
set DOCKER_HOST=tcp://localhost:2375
```
**For Linux/Mac:**
```bash
# Forward Docker socket through SSH
ssh -L localhost:2375:/var/run/docker.sock user@build-machine-ip
# Set Docker to use remote host
export DOCKER_HOST=tcp://localhost:2375
```
**Test connection (all platforms):**
```bash
docker ps
docker run --rm cpuminer-windows-builder echo "Remote Docker working!"
```
#### Option 2: Docker Contexts
**For Windows 11:**
```powershell
# PowerShell:
docker context create build-server --docker "host=ssh://user@build-machine-ip"
docker context use build-server
docker ps
# Command Prompt:
docker context create build-server --docker "host=ssh://user@build-machine-ip"
docker context use build-server
docker ps
```
**For Linux/Mac:**
```bash
# Create context for remote machine
docker context create build-server --docker "host=ssh://user@build-machine-ip"
# Use the remote context
docker context use build-server
# All docker commands now work remotely
docker ps
```
**Benefits:**
- ✅ Automatic SSH key management
- ✅ No manual port forwarding needed
- ✅ Clean context switching between local and remote
#### Option 3: VS Code Integration (Windows 11)
1. **Install VS Code on Windows:**
- Download: https://code.visualstudio.com/
- Install extensions:
- Docker (Microsoft)
- Remote SSH (Microsoft)
- Remote Development (Microsoft)
2. **Connect to Linux build machine:**
- `Ctrl+Shift+P` → "Remote-SSH: Connect to Host"
- Enter: `ssh user@build-machine-ip`
- VS Code will open a new window connected to the Linux machine
3. **Use VS Code Docker panel:**
- View containers, images, and networks on remote machine
- Manage remote Docker from VS Code interface
- Run builds with one click
4. **Run builds from VS Code:**
- Open Command Palette: `Ctrl+Shift+P`
- Select: "Tasks: Run Task"
- Choose: "Build Windows CPU Miner (Smart)"
- Build runs directly on the Linux machine!
**Benefits:**
- ✅ Full IDE integration
- ✅ Remote development environment
- ✅ Docker management from VS Code
- ✅ One-click builds
## Build Commands
Once connected, you can run builds remotely from your Windows machine:
**PowerShell (Windows 11):**
```powershell
# Smart build (recommended)
docker run --rm -v "${PWD}:/work" -v "${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
# Manual build
docker run --rm -v "${PWD}:/work" -v "${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows.sh"
# Clean build
docker run --rm -v "${PWD}:/work" -v "${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean"
```
**Command Prompt (Windows 11):**
```cmd
REM Smart build (recommended)
docker run --rm -v "%CD%:/work" -v "%CD%/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
REM Manual build
docker run --rm -v "%CD%:/work" -v "%CD%/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows.sh"
REM Clean build
docker run --rm -v "%CD%:/work" -v "%CD%/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean"
```
**Linux/Mac (original):**
```bash
# Smart build (recommended)
./build-windows-smart.sh
# Manual build
./build-windows.sh
# Clean build
./build-clean.sh
```
## Security Notes
- ✅ SSH tunneling provides encrypted connection
- ✅ No need to expose Docker API publicly
- ✅ All communication goes through secure SSH
- ✅ Use VPN for additional security if needed
## Troubleshooting
### Permission Denied
```bash
# If you get permission errors, try:
newgrp docker
# or logout and login again
```
### Connection Refused
```bash
# Check if Docker is running on build machine:
ssh user@build-machine sudo systemctl status docker
# Start Docker if needed:
ssh user@build-machine sudo systemctl start docker
```
### VS Code Issues
- Make sure Remote SSH extension is installed
- Check that SSH key authentication is set up
- Verify firewall allows SSH connections
## Alternative Methods
### Docker Remote API (Advanced)
For direct TCP access to Docker API (less secure, requires firewall configuration):
```bash
# On build machine (as root):
sudo systemctl edit docker
# Add: ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376
sudo systemctl restart docker
```
```bash
# On local machine:
export DOCKER_HOST=tcp://build-machine-ip:2376
```
### Docker Desktop (Windows/Mac)
If you have Docker Desktop on your local machine:
1. Settings → General → Enable "Expose daemon on tcp://localhost:2375"
2. Use SSH port forwarding as described above
## Performance Tips
- Use fast network connection between machines
- Consider using `--mount` instead of `-v` for better performance
- Use Docker contexts to easily switch between local and remote
## Need Help?
Check the main [BUILD_GUIDE.md](BUILD_GUIDE.md) for detailed instructions and troubleshooting.

View File

@@ -0,0 +1,103 @@
@echo off
REM Windows 11 Remote Docker Setup for RinHash Miner
REM This script helps Windows users set up remote Docker access
echo.
echo ====================================
echo 🐳 Windows 11 Remote Docker Setup
echo ====================================
echo.
REM Check if Docker Desktop is installed
docker --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Error: Docker Desktop is not installed or not in PATH
echo.
echo Please install Docker Desktop for Windows:
echo 1. Download from: https://www.docker.com/products/docker-desktop
echo 2. Enable WSL 2 integration during installation
echo 3. Restart this script after installation
echo.
pause
exit /b 1
)
echo ✅ Docker Desktop found:
docker --version
echo.
REM Check if SSH is available
ssh -V >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Error: OpenSSH Client is not available
echo.
echo Please enable OpenSSH Client:
echo Settings → Apps → Optional features → Add "OpenSSH Client"
echo.
pause
exit /b 1
)
echo ✅ OpenSSH Client available
echo.
echo 📋 Next Steps:
echo.
echo 1. On your Linux build machine, run:
echo cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
echo ./setup-remote-docker.sh
echo.
echo 2. Get your Linux machine IP address
echo.
echo 3. Set up SSH port forwarding (replace LINUX_IP with actual IP):
echo ssh -L localhost:2375:/var/run/docker.sock user@LINUX_IP
echo.
echo 4. In a NEW PowerShell/Command Prompt window, set environment:
echo PowerShell: $env:DOCKER_HOST = "tcp://localhost:2375"
echo CMD: set DOCKER_HOST=tcp://localhost:2375"
echo.
echo 5. Test remote connection:
echo docker run --rm cpuminer-windows-builder echo "Remote Docker working!"
echo.
echo 6. Build the miner:
echo docker run --rm -v "%CD%:/work" -v "%CD%/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
echo.
REM Create a PowerShell setup script
echo Creating setup script...
(
echo # PowerShell Remote Docker Setup Helper
echo # Run this after setting up SSH port forwarding
echo.
echo # Set Docker to use remote host
echo $env:DOCKER_HOST = "tcp://localhost:2375"
echo.
echo # Test connection
echo Write-Host "Testing remote Docker connection..." -ForegroundColor Green
echo docker ps
echo.
echo # Test RinHash build container
echo Write-Host "Testing RinHash build container..." -ForegroundColor Green
echo docker run --rm cpuminer-windows-builder echo "Build container ready!"
echo.
echo # Build commands
echo Write-Host "Build Commands:" -ForegroundColor Yellow
echo "# Smart build (recommended)"
echo docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
echo.
echo "# Manual build"
echo docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows.sh"
echo.
echo "# Clean build"
echo docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean"
) > setup-remote-docker-windows.ps1
echo ✅ Created setup helper: setup-remote-docker-windows.ps1
echo.
echo 📖 For detailed instructions, see:
echo REMOTE_DOCKER_README.md
echo BUILD_GUIDE.md
echo.
echo 🎉 Happy remote building from Windows 11! 🚀
echo.
pause

View File

@@ -0,0 +1,125 @@
# PowerShell Remote Docker Setup for RinHash Miner
# Windows 11 helper script for setting up remote Docker access
Write-Host ""
Write-Host "🐳 Windows 11 Remote Docker Setup" -ForegroundColor Cyan
Write-Host "==================================" -ForegroundColor Cyan
Write-Host ""
# Check Docker Desktop
try {
$dockerVersion = docker --version 2>$null
Write-Host "✅ Docker Desktop found: $dockerVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Error: Docker Desktop is not installed or not in PATH" -ForegroundColor Red
Write-Host ""
Write-Host "Please install Docker Desktop for Windows:" -ForegroundColor Yellow
Write-Host "1. Download from: https://www.docker.com/products/docker-desktop" -ForegroundColor White
Write-Host "2. Enable WSL 2 integration during installation" -ForegroundColor White
Write-Host "3. Restart PowerShell and run this script again" -ForegroundColor White
Read-Host "Press Enter to exit"
exit 1
}
# Check SSH
try {
$sshVersion = ssh -V 2>$null
Write-Host "✅ OpenSSH Client available" -ForegroundColor Green
} catch {
Write-Host "❌ Error: OpenSSH Client is not available" -ForegroundColor Red
Write-Host ""
Write-Host "Please enable OpenSSH Client:" -ForegroundColor Yellow
Write-Host "Settings → Apps → Optional features → Add 'OpenSSH Client'" -ForegroundColor White
Read-Host "Press Enter to exit"
exit 1
}
Write-Host ""
Write-Host "📋 Setup Instructions:" -ForegroundColor Magenta
Write-Host ""
Write-Host "1. On your Linux build machine, run:" -ForegroundColor Yellow
Write-Host " cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner" -ForegroundColor White
Write-Host " ./setup-remote-docker.sh" -ForegroundColor White
Write-Host ""
$linuxIP = Read-Host "2. Enter your Linux build machine IP address"
$userName = Read-Host "3. Enter your Linux username"
Write-Host ""
Write-Host "4. Set up SSH port forwarding:" -ForegroundColor Yellow
Write-Host " In a NEW PowerShell window, run:" -ForegroundColor White
Write-Host " ssh -L localhost:2375:/var/run/docker.sock ${userName}@${linuxIP}" -ForegroundColor Cyan
Write-Host ""
Write-Host "5. In ANOTHER PowerShell window, run these commands:" -ForegroundColor Yellow
Write-Host " # Set Docker to use remote host" -ForegroundColor Gray
Write-Host " `$env:DOCKER_HOST = 'tcp://localhost:2375'" -ForegroundColor Cyan
Write-Host ""
Write-Host " # Test connection" -ForegroundColor Gray
Write-Host " docker ps" -ForegroundColor Cyan
Write-Host ""
Write-Host " # Test RinHash build container" -ForegroundColor Gray
Write-Host " docker run --rm cpuminer-windows-builder echo 'Build container ready!'" -ForegroundColor Cyan
Write-Host ""
Write-Host "6. Build the RinHash miner:" -ForegroundColor Yellow
Write-Host " # Smart build (recommended)" -ForegroundColor Gray
Write-Host " docker run --rm -v `"`${PWD}:/work`" -v `"`${PWD}/build/win:/output`" cpuminer-windows-builder bash -c `"cd /work && ./build-windows-smart.sh`"" -ForegroundColor Cyan
Write-Host ""
Write-Host "📖 For detailed instructions, see:" -ForegroundColor Magenta
Write-Host " REMOTE_DOCKER_README.md" -ForegroundColor White
Write-Host " BUILD_GUIDE.md" -ForegroundColor White
Write-Host ""
Write-Host "🎉 Ready for remote building from Windows 11!" -ForegroundColor Green
Write-Host ""
# Create a helper script for easy connection
$helperScript = @"
# RinHash Remote Docker Helper
# Run this in PowerShell after setting up SSH port forwarding
# Set environment
`$env:DOCKER_HOST = "tcp://localhost:2375"
Write-Host "🔗 Connected to remote Docker daemon" -ForegroundColor Green
Write-Host ""
# Function to build RinHash
function Build-RinHash {
param([string]`$buildType = "smart")
switch (`$buildType) {
"smart" {
docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows-smart.sh"
}
"manual" {
docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && ./build-windows.sh"
}
"clean" {
docker run --rm -v "`${PWD}:/work" -v "`${PWD}/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean"
}
}
}
# Export functions
Export-ModuleMember -Function Build-RinHash
Write-Host "Available commands:" -ForegroundColor Yellow
Write-Host " Build-RinHash smart # Smart build (recommended)" -ForegroundColor White
Write-Host " Build-RinHash manual # Manual build" -ForegroundColor White
Write-Host " Build-RinHash clean # Clean build" -ForegroundColor White
"@
$helperScript | Out-File -FilePath "rinhash-remote-helper.ps1" -Encoding UTF8
Write-Host "✅ Created helper script: rinhash-remote-helper.ps1" -ForegroundColor Green
Write-Host ""
Write-Host "To use the helper script:" -ForegroundColor Yellow
Write-Host " . .\rinhash-remote-helper.ps1" -ForegroundColor White
Write-Host " Build-RinHash smart" -ForegroundColor White
Write-Host ""
Read-Host "Press Enter to continue"

View File

@@ -0,0 +1,101 @@
#!/bin/bash
#
# RinHash Miner - Remote Docker Setup Script
# This script helps set up remote Docker access for building from another machine
#
set -e
echo "🐳 RinHash Miner - Remote Docker Setup"
echo "====================================="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Check if running as root
if [[ $EUID -eq 0 ]]; then
echo -e "${RED}❌ Please do not run this script as root!${NC}"
echo "Run as a regular user with sudo access."
exit 1
fi
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo -e "${RED}❌ Docker is not installed!${NC}"
echo "Please install Docker first:"
echo " sudo apt update && sudo apt install -y docker.io"
exit 1
fi
echo -e "${BLUE}📋 Checking current Docker status...${NC}"
sudo systemctl status docker --no-pager -l || true
echo ""
echo -e "${BLUE}🔧 Setting up Docker access...${NC}"
# Add user to docker group
echo "Adding user to docker group..."
sudo usermod -aG docker $USER
# Enable and start Docker service
echo "Enabling and starting Docker service..."
sudo systemctl enable docker
sudo systemctl start docker
# Test Docker access
echo ""
echo -e "${BLUE}🧪 Testing Docker access...${NC}"
if docker ps &> /dev/null; then
echo -e "${GREEN}✅ Docker access working!${NC}"
else
echo -e "${YELLOW}⚠️ Docker access may require logout/login or 'newgrp docker'${NC}"
fi
# Show Docker version and info
echo ""
echo -e "${BLUE}📊 Docker Information:${NC}"
docker --version
docker system info --format "Server Version: {{.ServerVersion}}\nOperating System: {{.OperatingSystem}}\nArchitecture: {{.Architecture}}"
# Test the build container
echo ""
echo -e "${BLUE}🚀 Testing RinHash build container...${NC}"
if docker run --rm cpuminer-windows-builder echo "RinHash build environment ready!" 2>/dev/null; then
echo -e "${GREEN}✅ Build container working!${NC}"
else
echo -e "${YELLOW}⚠️ Build container not found. You may need to pull it:${NC}"
echo " docker pull cpuminer-windows-builder"
fi
echo ""
echo -e "${GREEN}🎉 Setup Complete!${NC}"
echo ""
echo -e "${BLUE}📖 Next Steps:${NC}"
echo ""
echo "1. ${YELLOW}For SSH tunneling (Recommended - Most Secure):${NC}"
echo " From your local machine:"
echo " ssh -L localhost:2375:/var/run/docker.sock $USER@$(hostname -I | awk '{print $1}')"
echo " export DOCKER_HOST=tcp://localhost:2375"
echo ""
echo "2. ${YELLOW}For Docker contexts:${NC}"
echo " docker context create remote-build --docker \"host=ssh://$USER@$(hostname -I | awk '{print $1}')\""
echo " docker context use remote-build"
echo ""
echo "3. ${YELLOW}For VS Code Remote Development:${NC}"
echo " - Install VS Code extensions: Docker, Remote-SSH"
echo " - Use Command Palette: Remote-SSH: Connect to Host"
echo " - Run build tasks from VS Code"
echo ""
echo "4. ${YELLOW}Test remote access:${NC}"
echo " docker run --rm cpuminer-windows-builder echo 'Remote Docker working!'"
echo ""
echo -e "${BLUE}📁 Build Commands:${NC}"
echo " ./build-windows-smart.sh # Smart build with curl detection"
echo " ./build-windows.sh # Manual build"
echo ""
echo -e "${GREEN}Happy building! 🚀${NC}"