55 lines
2.0 KiB
PowerShell
55 lines
2.0 KiB
PowerShell
# PetWash API Docker Deployment Script (PowerShell)
|
|
|
|
Write-Host "======================================" -ForegroundColor Cyan
|
|
Write-Host "PetWash API Docker Deployment" -ForegroundColor Cyan
|
|
Write-Host "======================================" -ForegroundColor Cyan
|
|
|
|
# Check Docker
|
|
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
|
|
Write-Host "ERROR: Docker is not installed. Please install Docker Desktop" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
# Check Docker Compose
|
|
if (-not (Get-Command docker-compose -ErrorAction SilentlyContinue)) {
|
|
Write-Host "ERROR: Docker Compose is not installed" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
# Stop and remove old containers
|
|
Write-Host "Stopping old containers..." -ForegroundColor Yellow
|
|
docker-compose down
|
|
|
|
# Build image
|
|
Write-Host "Building Docker image..." -ForegroundColor Yellow
|
|
docker-compose build
|
|
|
|
# Start containers
|
|
Write-Host "Starting containers..." -ForegroundColor Yellow
|
|
docker-compose up -d
|
|
|
|
# Wait for service to start
|
|
Write-Host "Waiting for service to start..." -ForegroundColor Yellow
|
|
Start-Sleep -Seconds 10
|
|
|
|
# Check container status
|
|
Write-Host "Checking container status..." -ForegroundColor Yellow
|
|
docker-compose ps
|
|
|
|
# View logs
|
|
Write-Host "======================================" -ForegroundColor Cyan
|
|
Write-Host "Recent logs:" -ForegroundColor Cyan
|
|
Write-Host "======================================" -ForegroundColor Cyan
|
|
docker-compose logs --tail=50 petwash-api
|
|
|
|
Write-Host ""
|
|
Write-Host "======================================" -ForegroundColor Green
|
|
Write-Host "Deployment complete!" -ForegroundColor Green
|
|
Write-Host "API URL: http://localhost:5000" -ForegroundColor Green
|
|
Write-Host "Swagger: http://localhost:5000/swagger" -ForegroundColor Green
|
|
Write-Host "======================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "View live logs: docker-compose logs -f petwash-api" -ForegroundColor Yellow
|
|
Write-Host "Stop service: docker-compose down" -ForegroundColor Yellow
|
|
Write-Host "Restart service: docker-compose restart" -ForegroundColor Yellow
|