You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #Requires -Version 5.1
- <#
- .SYNOPSIS
- Builds the Campaign Tracker Docker image and pushes it to the private registry.
- .EXAMPLE
- .\docker-publish.ps1
- .\docker-publish.ps1 -SkipBuild # push a previously built image
- #>
-
- param(
- [switch]$SkipBuild
- )
-
- Set-StrictMode -Version Latest
- $ErrorActionPreference = "Stop"
-
- # ---------------------------------------------------------------------------
- # Configuration
- # ---------------------------------------------------------------------------
- $REGISTRY_HOST = "192.168.1.200" # change port if needed, e.g. "192.168.1.200:5000"
- $IMAGE_NAME = "campaign-tracker"
- $FULL_TAG = "$REGISTRY_HOST/$IMAGE_NAME`:latest"
-
- # ---------------------------------------------------------------------------
- # Helpers
- # ---------------------------------------------------------------------------
- function Write-Step([string]$msg) {
- Write-Host "`n==> $msg" -ForegroundColor Cyan
- }
-
- function Assert-DockerRunning {
- docker info > $null 2>&1
- if ($LASTEXITCODE -ne 0) {
- Write-Error "Docker is not running or not reachable. Start Docker Desktop and retry."
- }
- }
-
- # ---------------------------------------------------------------------------
- # Main
- # ---------------------------------------------------------------------------
- Assert-DockerRunning
-
- if (-not $SkipBuild) {
- Write-Step "Building image: $FULL_TAG"
- docker build --tag $FULL_TAG .
- if ($LASTEXITCODE -ne 0) { Write-Error "docker build failed (exit $LASTEXITCODE)." }
- }
-
- Write-Step "Pushing image: $FULL_TAG"
- docker push $FULL_TAG
- if ($LASTEXITCODE -ne 0) { Write-Error "docker push failed (exit $LASTEXITCODE)." }
-
- Write-Host "`nDone. Image available at $FULL_TAG" -ForegroundColor Green
|