forked from EstrellaXD/Auto_Bangumi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
56 lines (49 loc) · 1.84 KB
/
build.ps1
File metadata and controls
56 lines (49 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
param(
[string]$Version = "dev",
[string]$Platforms = "linux/amd64"
)
$ErrorActionPreference = "Stop"
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host "AutoBangumi Docker Build" -ForegroundColor Cyan
Write-Host "Version: $Version" -ForegroundColor Cyan
Write-Host "Platforms: $Platforms" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan
# Build frontend
Write-Host "[1/4] Building frontend..." -ForegroundColor Yellow
Set-Location webui
pnpm install
pnpm build
Set-Location ..
# Copy dist to backend
Write-Host "[2/4] Copying frontend assets..." -ForegroundColor Yellow
if (Test-Path "backend/src/dist") {
Remove-Item -Recurse -Force "backend/src/dist"
}
Copy-Item -Recurse "webui/dist" "backend/src/dist"
# Create version info
Write-Host "[3/4] Creating version info..." -ForegroundColor Yellow
Set-Content -Path "backend/src/module/__version__.py" -Value "VERSION='$Version'"
# Build Docker image
Write-Host "[4/4] Building Docker image..." -ForegroundColor Yellow
if ($Platforms -like "*,*") {
# Multi-platform build (requires buildx)
docker buildx build `
--platform $Platforms `
-t "auto_bangumi:$Version" `
-t "auto_bangumi:latest" `
--load `
.
} else {
# Single platform build
docker build `
-t "auto_bangumi:$Version" `
-t "auto_bangumi:latest" `
.
}
Write-Host "=========================================" -ForegroundColor Green
Write-Host "Build complete!" -ForegroundColor Green
Write-Host "Image: auto_bangumi:$Version" -ForegroundColor Green
Write-Host "=========================================" -ForegroundColor Green
Write-Host ""
Write-Host "Run with:" -ForegroundColor Cyan
Write-Host " docker run -p 7892:7892 -v ./config:/app/config -v ./data:/app/data auto_bangumi:$Version"