Some checks failed
CI Check / check (push) Has been cancelled
- 创建统一的Modal组件,采用Apple风格设计 - 实现毛玻璃效果、圆角、动画和细边框描边 - 修复弹窗打开时背景滚动问题 - 修复分类管理中重复卡片和数组字符串显示问题 - 优化选项解析逻辑,添加去重和过滤机制
58 lines
1.9 KiB
PowerShell
58 lines
1.9 KiB
PowerShell
# 加载基础镜像脚本
|
|
# 在部署前自动加载项目目录中保存的基础镜像
|
|
|
|
param(
|
|
[string]$ImagesDir = (Join-Path $PSScriptRoot ".." "docker-images")
|
|
)
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " 加载基础 Docker 镜像" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
if (-not (Test-Path $ImagesDir)) {
|
|
Write-Host "镜像目录不存在: $ImagesDir" -ForegroundColor Yellow
|
|
Write-Host "跳过基础镜像加载" -ForegroundColor Yellow
|
|
return
|
|
}
|
|
|
|
$loadedCount = 0
|
|
$skippedCount = 0
|
|
|
|
Get-ChildItem $ImagesDir -Directory -ErrorAction SilentlyContinue | ForEach-Object {
|
|
$imageDir = $_.FullName
|
|
$imageName = $_.Name
|
|
|
|
Get-ChildItem $imageDir -Filter "*.tar" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
$tarFile = $_.FullName
|
|
$tarFileName = $_.Name
|
|
|
|
Write-Host "📦 加载镜像: $tarFileName" -ForegroundColor Yellow
|
|
|
|
# 检查镜像是否已存在
|
|
$imageInfo = docker load -i $tarFile 2>&1
|
|
if ($LASTEXITCODE -eq 0) {
|
|
$loadedImage = $imageInfo | Select-String -Pattern "Loaded image: (.+)" | ForEach-Object { $_.Matches[0].Groups[1].Value }
|
|
if ($loadedImage) {
|
|
Write-Host " ✓ 已加载: $loadedImage" -ForegroundColor Green
|
|
$loadedCount++
|
|
} else {
|
|
Write-Host " ✓ 镜像已存在,跳过" -ForegroundColor Gray
|
|
$skippedCount++
|
|
}
|
|
} else {
|
|
Write-Host " ✗ 加载失败" -ForegroundColor Red
|
|
}
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
if ($loadedCount -gt 0 -or $skippedCount -gt 0) {
|
|
Write-Host "完成!加载: $loadedCount, 跳过: $skippedCount" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "未找到需要加载的镜像" -ForegroundColor Yellow
|
|
}
|
|
|