auto_sigma_rule_generator/Dockerfile
bpmcdevitt eca51167af FEATURE: Add Docker Compose support for CLI application with comprehensive usage documentation
This commit adds complete Docker Compose support to the CLI application, making it easy to run
the SIGMA rule generator in a containerized environment:

DOCKER INFRASTRUCTURE:
- docker-compose.yml: Complete service orchestration (CLI app, PostgreSQL, Redis, optional Ollama)
- Dockerfile: Optimized CLI application container with all dependencies
- init.sql: Database initialization for PostgreSQL
- .env.example: Updated environment configuration for both Docker and native setups
- Makefile: Convenient commands for Docker operations (setup, up, down, shell, cli execution)

DOCUMENTATION UPDATES:
- README.md: Comprehensive Docker vs Native comparison with detailed usage examples
- CLAUDE.md: Updated project guidance with Docker Compose as recommended approach
- Added step-by-step setup instructions for both deployment methods
- Included command examples for both Docker Compose and native execution

DOCKER SERVICES:
- sigma-cli: Main CLI application container with volume mounts for data persistence
- db: PostgreSQL database for legacy migrations and data processing
- redis: Redis cache for performance optimization
- ollama: Optional local LLM service (profile-based)

DATA PERSISTENCE:
- Host-mounted directories: ./cves/, ./reports/, ./logs/, ./backend/templates/
- Named volumes: postgres_data, redis_data, ollama_data
- Complete data preservation between container restarts

This provides users with multiple deployment options:
1. Quick Docker Compose setup (recommended for testing/evaluation)
2. Native installation (recommended for production/development)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 13:52:28 -05:00

46 lines
No EOL
1 KiB
Docker

FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install additional CLI dependencies
RUN pip install --no-cache-dir click rich tabulate pyyaml
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p /app/cves /app/reports /app/logs /app/backend/templates
# Make CLI executable
RUN chmod +x /app/cli/sigma_cli.py
# Create a non-root user
RUN useradd --create-home --shell /bin/bash sigma
RUN chown -R sigma:sigma /app
USER sigma
# Set up CLI alias
RUN echo 'alias sigma-cli="python /app/cli/sigma_cli.py"' >> ~/.bashrc
WORKDIR /app
# Default command (can be overridden)
CMD ["python", "/app/cli/sigma_cli.py", "--help"]