feat: Docker部署与CI/CD集成, 搜索栏修复, 上传目录改为data
This commit is contained in:
27
scripts/push-docker.ps1
Normal file
27
scripts/push-docker.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
param(
|
||||
[string]$Registry = $env:DOCKER_REGISTRY,
|
||||
[string]$Namespace = $env:REG_NAMESPACE,
|
||||
[string]$ImageName = $(if($env:IMAGE_NAME){$env:IMAGE_NAME}else{"nexus-material"}),
|
||||
[string]$LocalImageName = $(if($env:LOCAL_IMAGE_NAME){$env:LOCAL_IMAGE_NAME}else{"nexus-material-share-app"}),
|
||||
[string]$Tag = $(if($env:IMAGE_TAG){$env:IMAGE_TAG}else{"latest"}),
|
||||
[string]$Username = $env:REG_USERNAME,
|
||||
[string]$Password = $env:REG_PASSWORD
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (-not $Registry) { throw "DOCKER_REGISTRY not set" }
|
||||
if (-not $Username -or -not $Password) { throw "REG_USERNAME/REG_PASSWORD not set" }
|
||||
if (-not $Namespace) { throw "REG_NAMESPACE not set" }
|
||||
|
||||
docker compose build app
|
||||
|
||||
$localRef = "$LocalImageName:$Tag"
|
||||
$remoteRef = "$Registry/$Namespace/$ImageName:$Tag"
|
||||
|
||||
# Secure login without echoing password
|
||||
$Password | docker login $Registry -u $Username --password-stdin
|
||||
docker tag $localRef $remoteRef
|
||||
docker push $remoteRef
|
||||
|
||||
Write-Host "Pushed $remoteRef"
|
||||
Reference in New Issue
Block a user