Files
idea.llm.gitea.repo.docker.…/README.md
2026-01-26 22:33:55 -06:00

140 lines
3.9 KiB
Markdown

# Docker Deployment Manager
Automated Docker deployment system for containerizing and deploying projects from Windows to Linux.
## Overview
**Phase 1 (Current):** CLI tool to generate Dockerfiles, docker-compose, and deployment scripts.
**Phase 2 (Planned):** Electron desktop app for central management and visibility across all projects.
## Quick Start
```powershell
# 1. Install dependencies
npm install
# 2. Detect a project type
npm run docker-deploy -- detect "C:\.bucket\Repos.Git\game.justone"
# 3. Initialize Docker config for a project
npm run docker-deploy -- init "C:\.bucket\Repos.Git\game.justone"
# 4. Build and deploy (from the target project directory)
cd C:\.bucket\Repos.Git\game.justone
.\build-image-tar.ps1 # Manual: creates tar, shows instructions
.\deploy-docker-auto.ps1 # Automated: builds, transfers, starts on server
```
## Commands
### detect
Identify project type without generating files.
```powershell
npm run docker-deploy -- detect [path]
npm run docker-deploy -- detect "C:\.bucket\Repos.Git\dotrepo.timer"
```
### init
Generate Docker configuration for a project.
```powershell
npm run docker-deploy -- init [path]
npm run docker-deploy -- init "C:\.bucket\Repos.Git\game.justone"
# Options:
# --no-interactive Skip prompts, use defaults
# --type <type> Force specific project type
# --port <port> Override default port
# --dry-run Show what would be generated
# --overwrite Replace existing files
```
### batch
Operations across multiple projects.
```powershell
# Scan all projects and show report
npm run docker-deploy -- batch detect --root "C:\.bucket\Repos.Git" --report
# Initialize all projects
npm run docker-deploy -- batch init --root "C:\.bucket\Repos.Git"
```
## Supported Project Types
| Type | Detection | Template |
|------|-----------|----------|
| Node.js Express | `package.json` with express | Multi-stage build |
| Node.js Vite+React | `package.json` with vite + react | Nginx static |
| Node.js Vite+React SSR | `package.json` with vite + react + express | Node runtime |
| Python Standard | `requirements.txt` | Python slim |
| Python ML/PyTorch | `requirements.txt` with torch | Python + system deps |
| .NET Blazor | `.csproj` with Blazor | SDK + ASP.NET runtime |
| Static Site | `index.html` | Nginx |
## Generated Files
When you run `init`, these files are created in the target project:
- `Dockerfile` - Container build instructions
- `docker-compose.yml` - Runtime configuration
- `.dockerignore` - Files excluded from image
- `docker-deployment.json` - Project configuration
- `.env.example` - Environment variables template
- `deploy-docker-auto.ps1` - Automated SSH deployment script
- `build-image-tar.ps1` - Manual build script
- `README.DOCKER.md` - Deployment documentation
## Deployment Workflow
### Option 1: Automated (SSH)
```powershell
.\deploy-docker-auto.ps1
# Builds image → creates tar → SCPs to server → loads → starts
```
### Option 2: Manual
```powershell
.\build-image-tar.ps1
# Then follow the printed instructions to SCP and deploy
```
### On the Linux Server
```bash
cd ~/containers/project-name/files
docker load -i project-name.tar
docker compose up -d
docker compose logs -f
```
## Configuration
### Per-Project: docker-deployment.json
```json
{
"project": { "name": "game-justone", "type": "nodejs-express" },
"runtime": { "port": 3000 },
"deployment": {
"sshHost": "192.168.8.178",
"sshUser": "deployer",
"targetPath": "~/containers/game-justone/files"
}
}
```
### Global: global-deployment-config.json
Default SSH settings used when initializing new projects.
## Phase 2 Roadmap
Electron desktop app with:
- Central view of all 35+ projects
- Docker status: configured / deployed / running
- One-click init, build, deploy
- Real-time logs and status updates
---
Built for managing Docker deployments across the Gitea repository collection.