|
| 1 | +# justfile for building and testing devcontainers locally |
| 2 | + |
| 3 | +# Default recipe - show available commands |
| 4 | +default: |
| 5 | + @just --list |
| 6 | + |
| 7 | +# Build the ai-container devcontainer locally |
| 8 | +build-ai-container tag="latest": |
| 9 | + #!/usr/bin/env bash |
| 10 | + echo "Building ai-container devcontainer..." |
| 11 | + if docker build \ |
| 12 | + -t codespaces-ai:{{tag}} \ |
| 13 | + -t ghcr.io/asw101/codespaces/ai:{{tag}} \ |
| 14 | + .devcontainer/ai-container/; then |
| 15 | + echo "✅ Built ai-container as codespaces-ai:{{tag}}" |
| 16 | + else |
| 17 | + echo "❌ Build failed for ai-container" |
| 18 | + exit 1 |
| 19 | + fi |
| 20 | + |
| 21 | +# Run the ai-container interactively for testing |
| 22 | +test-ai-container tag="latest": |
| 23 | + #!/usr/bin/env bash |
| 24 | + echo "Starting ai-container for testing..." |
| 25 | + docker run -it --rm \ |
| 26 | + -v $(pwd):/workspace \ |
| 27 | + -w /workspace \ |
| 28 | + --name test-ai-container \ |
| 29 | + codespaces-ai:{{tag}} \ |
| 30 | + bash |
| 31 | + |
| 32 | +# Run the ai-container as a background service (like VS Code would) |
| 33 | +run-ai-container tag="latest": |
| 34 | + #!/usr/bin/env bash |
| 35 | + echo "Starting ai-container in background..." |
| 36 | + docker run -d \ |
| 37 | + -v $(pwd):/workspace \ |
| 38 | + -w /workspace \ |
| 39 | + -p 8080:8080 \ |
| 40 | + --name ai-container-service \ |
| 41 | + codespaces-ai:{{tag}} \ |
| 42 | + tail -f /dev/null |
| 43 | + echo "✅ ai-container running as 'ai-container-service'" |
| 44 | + echo "Use 'just exec-ai-container' to get a shell" |
| 45 | + |
| 46 | +# Stop the background ai-container service |
| 47 | +stop-ai-container: |
| 48 | + #!/usr/bin/env bash |
| 49 | + echo "Stopping ai-container service..." |
| 50 | + docker stop ai-container-service || true |
| 51 | + docker rm ai-container-service || true |
| 52 | + echo "✅ ai-container service stopped" |
| 53 | + |
| 54 | +# Build and test ai-container in one command |
| 55 | +build-and-test-ai tag="latest": |
| 56 | + just build-ai-container {{tag}} |
| 57 | + just test-ai-container {{tag}} |
| 58 | + |
| 59 | +# Clean up Docker images and containers |
| 60 | +clean: |
| 61 | + #!/usr/bin/env bash |
| 62 | + echo "Cleaning up Docker resources..." |
| 63 | + docker stop ai-container-service 2>/dev/null || true |
| 64 | + docker rm ai-container-service 2>/dev/null || true |
| 65 | + docker rmi codespaces-ai:latest 2>/dev/null || true |
| 66 | + docker rmi ghcr.io/asw101/codespaces/ai:latest 2>/dev/null || true |
| 67 | + echo "✅ Cleanup complete" |
| 68 | + |
| 69 | +# Test specific tools inside the container |
| 70 | +test-tools tag="latest": |
| 71 | + #!/usr/bin/env bash |
| 72 | + echo "Testing tools in ai-container..." |
| 73 | + docker run --rm codespaces-ai:{{tag}} bash -c " |
| 74 | + echo '=== Go version ===' |
| 75 | + go version |
| 76 | + echo |
| 77 | + echo '=== Rust version ===' |
| 78 | + rustc --version |
| 79 | + cargo --version |
| 80 | + echo |
| 81 | + echo '=== Node.js version ===' |
| 82 | + node --version |
| 83 | + npm --version |
| 84 | + echo |
| 85 | + echo '=== Azure CLI ===' |
| 86 | + az --version | head -1 |
| 87 | + echo |
| 88 | + echo '=== GitHub CLI ===' |
| 89 | + gh --version |
| 90 | + echo |
| 91 | + echo '=== Wassette ===' |
| 92 | + wassette --version |
| 93 | + echo |
| 94 | + echo '=== NPM global packages ===' |
| 95 | + npm list -g --depth=0 |
| 96 | + " |
0 commit comments