ef4aa42b0b
- playground/backend/main.go — Go HTTP server with /compile endpoint - playground/frontend/index.html — Monaco Editor with 8 code examples - playground/sandbox/Dockerfile — isolated Docker container with buxc2 - playground/docker-compose.yml — orchestrates backend + sandbox - playground/Makefile — build and run targets - playground/README.md — deployment guide for VPS with nginx + SSL
56 lines
1.2 KiB
Makefile
56 lines
1.2 KiB
Makefile
# Bux Playground — Makefile
|
|
# Run from project root: make -C playground <target>
|
|
|
|
.PHONY: all build-sandbox build-backend run stop clean
|
|
|
|
SANDBOX_IMAGE = bux-playground-sandbox
|
|
BACKEND_IMAGE = bux-playground-backend
|
|
PORT = 8080
|
|
|
|
all: build-sandbox build-backend
|
|
|
|
# Build the sandbox Docker image (needs buxc2 + lib + rt)
|
|
build-sandbox:
|
|
@echo "Building sandbox image..."
|
|
@docker build \
|
|
-f sandbox/Dockerfile \
|
|
-t $(SANDBOX_IMAGE) \
|
|
..
|
|
|
|
# Build the backend Go server
|
|
build-backend:
|
|
@echo "Building backend image..."
|
|
@docker build \
|
|
-f backend/Dockerfile \
|
|
-t $(BACKEND_IMAGE) \
|
|
.
|
|
|
|
# Run everything with docker-compose
|
|
run:
|
|
@echo "Starting Bux Playground on http://localhost:$(PORT)"
|
|
@docker-compose up
|
|
|
|
# Run in background
|
|
run-detached:
|
|
@echo "Starting Bux Playground in background on http://localhost:$(PORT)"
|
|
@docker-compose up -d
|
|
|
|
# Stop
|
|
stop:
|
|
@docker-compose down
|
|
|
|
# Clean images and containers
|
|
clean:
|
|
@docker-compose down --rmi all -v
|
|
@docker rmi $(SANDBOX_IMAGE) $(BACKEND_IMAGE) 2>/dev/null || true
|
|
|
|
# Development mode (local backend, no Docker sandbox)
|
|
dev:
|
|
@echo "Starting backend in dev mode..."
|
|
cd backend && go run main.go
|
|
|
|
# Quick test
|
|
test:
|
|
@echo "Testing /health endpoint..."
|
|
@curl -s http://localhost:$(PORT)/health | jq .
|