# CVE-SIGMA Auto Generator - Docker Compose Makefile # Convenient commands for managing the CLI application with Docker .PHONY: help build up down logs shell restart clean setup test-docker # Default target help: @echo "CVE-SIGMA Auto Generator - Docker Commands" @echo "" @echo "Setup Commands:" @echo " setup - Initial setup (copy .env.example, build containers)" @echo " build - Build Docker containers" @echo "" @echo "Service Management:" @echo " up - Start all services (db, redis, sigma-cli)" @echo " up-ollama - Start all services including Ollama LLM" @echo " down - Stop all services" @echo " restart - Restart all services" @echo " clean - Stop and remove all containers and volumes" @echo "" @echo "CLI Access:" @echo " shell - Access interactive CLI shell" @echo " cli CMD=\"...\" - Run specific CLI command" @echo " logs - View application logs" @echo "" @echo "Testing:" @echo " test-docker - Test Docker setup and CLI functionality" @echo "" @echo "Examples:" @echo " make cli CMD=\"process year 2024\"" @echo " make cli CMD=\"stats overview\"" # Setup setup: @echo "Setting up CVE-SIGMA CLI with Docker..." @if [ ! -f .env ]; then cp .env.example .env && echo "Created .env file"; fi @echo "Edit .env file with your API keys (optional but recommended)" @echo "Then run: make build && make up" build: @echo "Building Docker containers..." docker-compose build # Service management up: @echo "Starting CVE-SIGMA CLI services..." docker-compose up -d @echo "Services started. Access CLI with: make shell" up-ollama: @echo "Starting CVE-SIGMA CLI services with Ollama LLM..." docker-compose --profile ollama up -d @echo "Services started with Ollama. Access CLI with: make shell" down: @echo "Stopping services..." docker-compose down restart: @echo "Restarting services..." docker-compose restart clean: @echo "Cleaning up containers and volumes..." docker-compose down -v docker system prune -f # CLI access shell: @echo "Accessing CLI shell..." docker-compose exec sigma-cli bash cli: @if [ -z "$(CMD)" ]; then \ echo "Usage: make cli CMD=\"your_command_here\""; \ echo "Example: make cli CMD=\"stats overview\""; \ else \ echo "Running CLI command: $(CMD)"; \ docker-compose exec sigma-cli python cli/sigma_cli.py $(CMD); \ fi logs: @echo "Viewing application logs..." docker-compose logs -f sigma-cli # Testing test-docker: @echo "Testing Docker setup..." @echo "1. Building containers..." @make build @echo "2. Starting services..." @make up @echo "3. Waiting for services to be ready..." @sleep 10 @echo "4. Testing CLI help command..." @docker-compose exec sigma-cli python cli/sigma_cli.py --help @echo "5. Testing stats overview..." @docker-compose exec sigma-cli python cli/sigma_cli.py stats overview @echo "Docker setup test completed successfully!" # Convenience targets for common CLI operations stats: @make cli CMD="stats overview" process-2024: @make cli CMD="process year 2024" search-critical: @make cli CMD="search cve --severity critical --limit 10" # Development helpers dev-up: @echo "Starting development environment..." @make up @echo "Services ready. Use 'make shell' for CLI access" dev-down: @make down # Show service status status: @echo "Service Status:" @docker-compose ps