74 lines
2.3 KiB
Makefile
74 lines
2.3 KiB
Makefile
set shell := ["bash", "-c"]
|
|
|
|
NIX := "/nix/var/nix/profiles/default/bin/nix"
|
|
|
|
# Start local backing services (one-time, no boot persistence)
|
|
infra:
|
|
@echo "🐰 Starting RabbitMQ..."
|
|
brew services run rabbitmq || true
|
|
@echo "💾 Starting Redis..."
|
|
brew services run redis || true
|
|
@echo "✅ Local infra is running. Use 'brew services list' to verify."
|
|
|
|
# Setup environment
|
|
setup:
|
|
@echo "🔧 Installing SOTA stack dependencies..."
|
|
cd ci && ~/.bun/bin/bun install
|
|
@if [ ! -f dagger.json ]; then \
|
|
echo "Initializing Dagger module..."; \
|
|
dagger init --sdk=typescript --source=ci; \
|
|
fi
|
|
|
|
# Start coding natively (Track 1)
|
|
watch:
|
|
~/.bun/bin/bun run ci/watch.ts
|
|
|
|
# Enter the native Nix development environment
|
|
shell:
|
|
{{NIX}} develop
|
|
|
|
# Fast native validation in Dagger (Track 2)
|
|
validate:
|
|
dagger call --progress=plain validate --source=.
|
|
|
|
# Build local ARM64 image via Dagger and export to OrbStack
|
|
build:
|
|
@echo "🔨 Building image via Dagger..."
|
|
@rm -f ./admin.tar
|
|
dagger call --progress=plain build-local --source=. export --path=./admin.tar
|
|
@echo "🧹 Cleaning up old Docker artifacts to free space..."
|
|
docker system prune -f
|
|
@echo "📦 Loading image into Docker..."
|
|
#!/bin/bash
|
|
LOAD_OUTPUT=$(docker load < ./admin.tar)
|
|
echo "$LOAD_OUTPUT"
|
|
IMAGE_ID=$(echo "$LOAD_OUTPUT" | awk '/Loaded image ID: sha256:/ {print $4}' | cut -d: -f2)
|
|
if [ -z "$IMAGE_ID" ]; then
|
|
IMAGE_ID=$(echo "$LOAD_OUTPUT" | grep -oE '[0-9a-f]{12,}' | tail -n 1)
|
|
fi
|
|
echo "Tagging $IMAGE_ID as jamkazam-admin:local-v2..."
|
|
docker tag "$IMAGE_ID" jamkazam-admin:local-v2
|
|
rm ./admin.tar
|
|
echo "✅ Image loaded as 'jamkazam-admin:local-v2'"
|
|
|
|
# Run Rails server natively using the Nix shell (SOTA Inner Loop)
|
|
dev: infra
|
|
{{NIX}} develop --command bash -c "bundle install && bundle exec rails server"
|
|
|
|
# Run the local image in OrbStack, connected to host infra
|
|
run:
|
|
docker run -it --rm \
|
|
-p 3000:3000 \
|
|
-v {{invocation_directory()}}/..:/jam-cloud \
|
|
-w /jam-cloud/admin \
|
|
-e DATABASE_URL="postgres://postgres:postgres@host.orb.internal:5432/jam" \
|
|
-e REDIS_URL="redis://host.orb.internal:6379/1" \
|
|
-e RABBITMQ_URL="amqp://guest:guest@host.orb.internal:5672" \
|
|
-e RAILS_MASTER_KEY=$RAILS_MASTER_KEY \
|
|
jamkazam-admin:local-v2
|
|
|
|
# The Big Red Button
|
|
ship:
|
|
@echo "🚀 Shipping to Production..."
|
|
dagger call ship --source=. --kubeconfig=file:$KUBECONFIG --registry="your-registry.io"
|