switch between arti and default

This commit is contained in:
pratik
2025-10-15 14:28:38 -05:00
parent b8cabbe0c8
commit 56dcc04ad7
13 changed files with 749 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
[CmdletBinding()]
param(
[switch]$Rebuild,
[switch]$Bsf,
[switch]$Help
)
@@ -15,8 +16,12 @@ if ($Help) {
Write-Host ""
Write-Host "Options:" -ForegroundColor Yellow
Write-Host " -Rebuild Force rebuild of all containers" -ForegroundColor White
Write-Host " -Bsf Use Artifactory npm registry instead of public npm" -ForegroundColor White
Write-Host " -Help Show this help message" -ForegroundColor White
Write-Host ""
Write-Host "Environment Variables (when using -Bsf):" -ForegroundColor Yellow
Write-Host ' $env:ARTIFACTORY_AUTH_TOKEN Authentication token for Artifactory' -ForegroundColor White
Write-Host ""
Write-Host "Brings up the complete stack: database, backend API, and frontend" -ForegroundColor Green
Write-Host ""
exit 0
@@ -27,6 +32,29 @@ Write-Host "Obsidian - Quick Start" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host ""
# Determine npm registry and build arguments
$NpmRegistry = "public"
$BuildArgs = @()
if ($Bsf) {
$NpmRegistry = "artifactory"
$BuildArgs += "--build-arg"
$BuildArgs += "NPM_REGISTRY=artifactory"
Write-Host "Using Artifactory npm registry" -ForegroundColor Yellow
if ($env:ARTIFACTORY_AUTH_TOKEN) {
Write-Host "[OK] Artifactory auth token detected" -ForegroundColor Green
$BuildArgs += "--build-arg"
$BuildArgs += "ARTIFACTORY_AUTH_TOKEN=$env:ARTIFACTORY_AUTH_TOKEN"
} else {
Write-Host "[WARNING] ARTIFACTORY_AUTH_TOKEN not set (may be required for authentication)" -ForegroundColor Yellow
}
} else {
Write-Host "Using public npm registry (registry.npmjs.org)" -ForegroundColor Green
}
Write-Host ""
# Check if Docker is installed
if (-not (Get-Command "docker" -ErrorAction SilentlyContinue)) {
Write-Host "Error: Docker is not installed. Please install Docker Desktop first." -ForegroundColor Red
@@ -73,20 +101,40 @@ if ($Rebuild) {
Write-Host "Removing existing images for rebuild..." -ForegroundColor White
& docker compose down --rmi local
Write-Host "Building and starting all services..." -ForegroundColor White
& docker compose up -d --build
if ($BuildArgs.Count -gt 0) {
& docker compose build $BuildArgs
& docker compose up -d
} else {
& docker compose up -d --build
}
} else {
& docker-compose down
Write-Host "Removing existing images for rebuild..." -ForegroundColor White
& docker-compose down --rmi local
Write-Host "Building and starting all services..." -ForegroundColor White
& docker-compose up -d --build
if ($BuildArgs.Count -gt 0) {
& docker-compose build $BuildArgs
& docker-compose up -d
} else {
& docker-compose up -d --build
}
}
} else {
Write-Host "Starting all services..." -ForegroundColor Green
if ($ComposeCmd -eq "docker compose") {
& docker compose up -d
if ($BuildArgs.Count -gt 0) {
& docker compose build $BuildArgs
& docker compose up -d
} else {
& docker compose up -d
}
} else {
& docker-compose up -d
if ($BuildArgs.Count -gt 0) {
& docker-compose build $BuildArgs
& docker-compose up -d
} else {
& docker-compose up -d
}
}
}