fix(ci): heredoc indentation in publish workflows + add dev-start.sh

Two fixes:
1. publish-canvas-image.yml + publish-platform-image.yml: the JSON
   heredoc for config.json had leading whitespace from YAML indentation,
   producing invalid JSON. Docker fell back to osxkeychain → -25308.
   Fixed by removing indentation inside the heredoc body.

2. Added scripts/dev-start.sh — one-command local dev environment.
   Starts infra (docker-compose), platform (Go), and canvas (Next.js)
   with proper health checks and cleanup on Ctrl-C.
This commit is contained in:
Hongming Wang 2026-04-16 05:56:16 -07:00
parent d376c55447
commit 77d6f5e7a0
3 changed files with 84 additions and 12 deletions

View File

@ -48,18 +48,21 @@ jobs:
# Same workaround as publish-platform-image.yml — launchd service
# runners can't reach the Keychain, so we write a disposable
# config.json with an empty credsStore to force auths-map storage.
# IMPORTANT: no indentation inside the heredoc — JSON must be valid.
shell: bash
run: |
set -euo pipefail
mkdir -p "${RUNNER_TEMP}/docker-config"
cat > "${RUNNER_TEMP}/docker-config/config.json" <<'JSON'
{
"auths": {},
"credsStore": "",
"credHelpers": {}
}
JSON
{
"auths": {},
"credsStore": "",
"credHelpers": {}
}
JSON
echo "DOCKER_CONFIG=${RUNNER_TEMP}/docker-config" >> "${GITHUB_ENV}"
echo "=== config.json ==="
cat "${RUNNER_TEMP}/docker-config/config.json"
echo "=== Runner docker diagnostics ==="
command -v docker || echo "(docker not in PATH)"
docker --version 2>&1 || true

View File

@ -67,12 +67,12 @@ jobs:
set -euo pipefail
mkdir -p "${RUNNER_TEMP}/docker-config"
cat > "${RUNNER_TEMP}/docker-config/config.json" <<'JSON'
{
"auths": {},
"credsStore": "",
"credHelpers": {}
}
JSON
{
"auths": {},
"credsStore": "",
"credHelpers": {}
}
JSON
echo "DOCKER_CONFIG=${RUNNER_TEMP}/docker-config" >> "${GITHUB_ENV}"
echo "=== Runner docker diagnostics ==="
echo "PATH=$PATH"

69
scripts/dev-start.sh Executable file
View File

@ -0,0 +1,69 @@
#!/bin/sh
# dev-start.sh — one-command local development environment.
#
# Starts: Postgres, Redis, Platform (Go :8080), Canvas (Next.js :3000)
# Stops all on Ctrl-C.
#
# Prerequisites:
# - Docker (for Postgres + Redis)
# - Go 1.25+ (for platform)
# - Node.js 20+ (for canvas)
#
# Usage:
# ./scripts/dev-start.sh
# # Open http://localhost:3000
set -e
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cleanup() {
echo ""
echo "Shutting down..."
kill $PLATFORM_PID $CANVAS_PID 2>/dev/null || true
docker compose -f "$ROOT/docker-compose.infra.yml" down 2>/dev/null || true
echo "Done."
}
trap cleanup EXIT INT TERM
echo "==> Starting infrastructure (Postgres, Redis)..."
docker compose -f "$ROOT/docker-compose.infra.yml" up -d
echo "==> Waiting for Postgres..."
until docker compose -f "$ROOT/docker-compose.infra.yml" exec -T postgres pg_isready -q 2>/dev/null; do
sleep 1
done
echo " Postgres ready."
echo "==> Starting Platform (Go :8080)..."
cd "$ROOT/platform"
go run ./cmd/server &
PLATFORM_PID=$!
echo "==> Waiting for Platform health..."
until curl -sf http://localhost:8080/health >/dev/null 2>&1; do
sleep 1
done
echo " Platform ready."
echo "==> Starting Canvas (Next.js :3000)..."
cd "$ROOT/canvas"
if [ ! -d node_modules ]; then
npm install
fi
npm run dev &
CANVAS_PID=$!
echo ""
echo "============================================"
echo " Molecule AI dev environment running"
echo ""
echo " Canvas: http://localhost:3000"
echo " Platform: http://localhost:8080"
echo " Postgres: localhost:5432"
echo " Redis: localhost:6379"
echo ""
echo " Press Ctrl-C to stop all services"
echo "============================================"
wait