Spaces:
Running
Running
File size: 2,390 Bytes
fff13d1 |
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# Makefile for Blaxel Manim Sandbox
IMAGE_NAME = manim-sandbox
CONTAINER_NAME = manim-sandbox-test
PORT = 8080
.PHONY: build run stop clean test logs help
# Default target
help:
@echo "Blaxel Manim Sandbox Makefile"
@echo ""
@echo "Available targets:"
@echo " build - Build the Docker image"
@echo " run - Run the container locally"
@echo " stop - Stop the running container"
@echo " clean - Remove container and image"
@echo " test - Test the sandbox API"
@echo " logs - View container logs"
@echo " shell - Open shell in running container"
@echo " deploy - Deploy to Blaxel (requires bl CLI)"
# Build the Docker image
build:
@echo "Building Docker image..."
docker build -f Dockerfile.sandbox -t $(IMAGE_NAME) .
@echo "Build complete!"
# Run the container locally
run:
@echo "Starting container..."
docker run -d \
--name $(CONTAINER_NAME) \
-p $(PORT):8080 \
$(IMAGE_NAME)
@echo "Container started on port $(PORT)"
@echo "Sandbox API available at http://localhost:$(PORT)"
# Stop the container
stop:
@echo "Stopping container..."
-docker stop $(CONTAINER_NAME)
-docker rm $(CONTAINER_NAME)
@echo "Container stopped"
# Clean up everything
clean: stop
@echo "Removing image..."
-docker rmi $(IMAGE_NAME)
@echo "Cleanup complete"
# Test the sandbox API
test:
@echo "Testing sandbox API..."
@echo ""
@echo "1. Health check:"
curl -s http://localhost:$(PORT)/health || echo "Failed"
@echo ""
@echo ""
@echo "2. Testing Manim installation:"
curl -s -X POST http://localhost:$(PORT)/process \
-H "Content-Type: application/json" \
-d '{"command": "manim --version", "waitForCompletion": true}' | jq '.' || echo "Failed"
@echo ""
@echo "3. Testing FFmpeg installation:"
curl -s -X POST http://localhost:$(PORT)/process \
-H "Content-Type: application/json" \
-d '{"command": "ffmpeg -version", "waitForCompletion": true}' | jq '.' || echo "Failed"
# View container logs
logs:
docker logs -f $(CONTAINER_NAME)
# Open shell in running container
shell:
docker exec -it $(CONTAINER_NAME) /bin/bash
# Deploy to Blaxel
deploy:
@echo "Deploying to Blaxel..."
bl deploy
@echo "Deployment complete!"
@echo "Check status with: bl get sandbox manim-sandbox --watch"
# Rebuild and run (convenience target)
rebuild: clean build run
@echo "Rebuild complete and container running"
|