Files
neuron-web/build-stage.sh
T
will.anderson 3e377e2bb6 ci: replace build-stage.sh concatenation with elb build from ci-base
- stage.yaml and deploy.yaml now extract El SDK from ci-base (docker cp /opt/el) and run elb build to produce dist/neuron-landing
- JS El sources compiled via elc --target=js in a dedicated step, matching dev.yaml exactly
- build-stage.sh replaced with thin elb wrapper for local dev use
- Removes the broken "Set up El SDK" stub (echo EL_HOME) and old build-stage.sh invocation from both workflows
2026-05-07 01:55:08 -05:00

47 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# build-stage.sh — Build the Stage marketing image (neuron-web + soul-demo).
#
# Thin wrapper around elb. The El build system handles compilation.
# ELB, ELC, and EL_RUNTIME must be set by the caller (extracted from ci-base
# in CI, or pointed at the local El SDK in dev).
#
# Usage:
# ELB=/opt/el/dist/bin/elb ELC=... EL_RUNTIME=... ./build-stage.sh <tag>
set -euo pipefail
cd "$(dirname "$0")"
TAG="${1:-dev}"
if [ -z "${ELB:-}" ] || [ -z "${ELC:-}" ] || [ -z "${EL_RUNTIME:-}" ]; then
echo "Error: ELB, ELC, and EL_RUNTIME must be set" >&2
echo " Extract from ci-base or point to local El SDK at foundation/el" >&2
exit 1
fi
echo "==> Building neuron-web with elb"
"$ELB" build --elc "$ELC" --runtime "$EL_RUNTIME"
echo " Binary: $(ls -lh dist/neuron-landing)"
echo "==> Compiling client-side El (src/js/*.el) → dist/js/"
cp "$EL_RUNTIME/el_runtime.js" src/js/
mkdir -p dist/js
for f in src/js/*.el; do
[ -f "$f" ] || continue
name=$(basename "$f" .el)
"$ELC" --target=js --bundle --minify --obfuscate "$f" > "dist/js/${name}.js"
echo " compiled: src/js/${name}.el → dist/js/${name}.js"
done
rm -f src/js/el_runtime.js
echo "==> Building Docker image marketing:${TAG}"
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from us-central1-docker.pkg.dev/neuron-785695/neuron-marketing/marketing:latest \
-f Dockerfile.stage \
-t "marketing:${TAG}" \
.
echo "==> Done. marketing:${TAG} built."