aboutsummaryrefslogtreecommitdiff
path: root/scripts/build-prod.sh
blob: d356034c3e1911285ad124bf71f46c6b6c4cb55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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"