aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build-prod.ps127
-rw-r--r--scripts/build-prod.sh29
2 files changed, 56 insertions, 0 deletions
diff --git a/scripts/build-prod.ps1 b/scripts/build-prod.ps1
new file mode 100644
index 0000000..b4c7107
--- /dev/null
+++ b/scripts/build-prod.ps1
@@ -0,0 +1,27 @@
+#!/usr/bin/env pwsh
+$ErrorActionPreference = "Stop"
+$ROOT = Split-Path -Parent $PSScriptRoot
+
+Write-Host "=== Building YAUM single binary ===" -ForegroundColor Green
+Write-Host ""
+
+Write-Host "1. Building frontend..." -ForegroundColor Yellow
+Set-Location "$ROOT/frontend"
+npm ci
+npm run build
+
+Write-Host ""
+Write-Host "2. Copying frontend build to Go embed directory..." -ForegroundColor Yellow
+Remove-Item -Path "$ROOT/backend/internal/static/build" -Recurse -Force -ErrorAction SilentlyContinue
+Copy-Item -Path "$ROOT/frontend/build" -Destination "$ROOT/backend/internal/static/build" -Recurse -Force
+
+Write-Host ""
+Write-Host "3. Building Go binary..." -ForegroundColor Yellow
+Set-Location "$ROOT/backend"
+go build -o yaum.exe ./cmd/server/
+
+Write-Host ""
+Write-Host "=== Done! Binary at backend\yaum.exe ===" -ForegroundColor Green
+Write-Host ""
+Write-Host "Run with:" -ForegroundColor Cyan
+Write-Host " cd backend && .\yaum.exe" -ForegroundColor White
diff --git a/scripts/build-prod.sh b/scripts/build-prod.sh
new file mode 100644
index 0000000..d356034
--- /dev/null
+++ b/scripts/build-prod.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+ROOT="$DIR/.."
+
+echo "=== Building YAUM single binary ==="
+
+echo ""
+echo "1. Building frontend..."
+cd "$ROOT/frontend"
+npm ci
+npm run build
+
+echo ""
+echo "2. Copying frontend build to Go embed directory..."
+rm -rf "$ROOT/backend/internal/static/build"
+cp -r "$ROOT/frontend/build" "$ROOT/backend/internal/static/build"
+
+echo ""
+echo "3. Building Go binary..."
+cd "$ROOT/backend"
+go build -o yaum ./cmd/server/
+
+echo ""
+echo "=== Done! Binary at backend/yaum ==="
+echo ""
+echo "Run with:"
+echo " cd backend && ./yaum"