perf: docker + next.js build optimisation - dockerignore exclusions, BuildKit cache mounts, backend image reuse, memory limits, next.js bundle tree-shaking
This commit is contained in:
39
build.ps1
Normal file
39
build.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env powershell
|
||||
# build.ps1 — Clean, fast Docker build script for PragatiVeer v2
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
# What this script does:
|
||||
# 1. Enables Docker BuildKit (required for --mount=type=cache to work)
|
||||
# 2. Runs `docker compose build --parallel` which:
|
||||
# - Builds backend image ONCE and tags it as pragativeer-backend:local
|
||||
# - worker + beat containers reuse that image (no rebuild)
|
||||
# - BuildKit caches pip wheels and npm packages between builds
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
|
||||
$env:DOCKER_BUILDKIT = "1"
|
||||
$env:COMPOSE_DOCKER_CLI_BUILD = "1"
|
||||
|
||||
Write-Host "═══════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " PragatiVeer v2 — Optimised Docker Build" -ForegroundColor Cyan
|
||||
Write-Host "═══════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "▶ BuildKit enabled (cache mounts active)" -ForegroundColor Green
|
||||
Write-Host "▶ Building backend image first..." -ForegroundColor Yellow
|
||||
|
||||
# Build backend image first so worker/beat can reuse it
|
||||
docker compose build backend
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "▶ Building remaining services in parallel..." -ForegroundColor Yellow
|
||||
|
||||
# Build remaining services (frontend, etc.)
|
||||
docker compose build --parallel frontend
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✔ Build complete. Starting services..." -ForegroundColor Green
|
||||
docker compose up -d
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✔ All services started." -ForegroundColor Green
|
||||
Write-Host " Frontend: http://localhost:3000" -ForegroundColor Cyan
|
||||
Write-Host " Backend: http://localhost:8000" -ForegroundColor Cyan
|
||||
Write-Host " MinIO: http://localhost:9001" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user