# Artifact Editor - AI-enhanced visual artifact creation # # Multi-stage build: # Stage 1: Build SmartTools base # Stage 2: Build Artifact Editor with SmartTools # # Build: docker build -t artifact-editor . # Run: docker run -it --rm artifact-editor artifact-ai --help # GUI: See usage examples at bottom # ============================================================================== # Stage 1: SmartTools Base # ============================================================================== FROM python:3.12-slim AS smarttools WORKDIR /smarttools ARG SMARTTOOLS_REPO=https://gitea.brrd.tech/rob/SmartTools.git RUN apt-get update && apt-get install -y --no-install-recommends git && \ git clone ${SMARTTOOLS_REPO} . || \ echo "Clone failed - will need COPY in next stage" RUN pip install --no-cache-dir -e . || true # ============================================================================== # Stage 2: Artifact Editor # ============================================================================== FROM python:3.12-slim LABEL maintainer="rob" LABEL description="Artifact Editor - AI-enhanced diagram and artifact creation" # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ plantuml \ # PyQt6 dependencies (for GUI - optional for CLI use) libgl1-mesa-glx \ libegl1-mesa \ libxkbcommon0 \ libdbus-1-3 \ libxcb-cursor0 \ libxcb-icccm4 \ libxcb-keysyms1 \ libxcb-shape0 \ libxcb-xinerama0 \ libxcb-randr0 \ libxcb-render-util0 \ # For inkscape/rsvg (SVG to PNG conversion) librsvg2-bin \ && rm -rf /var/lib/apt/lists/* # Install Node.js and mermaid-cli (optional, for Mermaid diagrams) RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs && \ npm install -g @mermaid-js/mermaid-cli 2>/dev/null || true && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy SmartTools from stage 1 COPY --from=smarttools /smarttools /smarttools # Install SmartTools RUN pip install --no-cache-dir -e /smarttools # Copy Artifact Editor files COPY pyproject.toml README.md ./ COPY src/ ./src/ COPY smarttools/ ./smarttools/ COPY install.sh ./ # Install Artifact Editor and dependencies RUN pip install --no-cache-dir -e . && \ pip install --no-cache-dir PyQt6 pygments # Create directories RUN mkdir -p /root/.smarttools /root/.local/bin # Install artifact SmartTools RUN ./install.sh # Install SmartTools example tools RUN python /smarttools/examples/install.py 2>/dev/null || true && \ smarttools refresh 2>/dev/null || true # Add local bin to PATH ENV PATH="/root/.local/bin:${PATH}" # Healthcheck - verify CLI tools work RUN artifact-ai --help && \ artifact-export --help && \ smarttools list | head -5 # Default: show help CMD ["artifact-ai", "--help"] # ============================================================================== # Usage Examples: # ============================================================================== # docker build -t artifact-editor . # # CLI (no display required): # docker run -it --rm artifact-editor artifact-ai --format plantuml --instruction "Create class diagram" # docker run -it --rm artifact-editor artifact-export --format plantuml --to /tmp/out.svg # echo "@startuml\nA->B\n@enduml" | docker run -i --rm artifact-editor artifact-export --format plantuml --to /dev/stdout # # GUI (requires X11 forwarding): # xhost +local:docker # docker run -it --rm \ # -e DISPLAY=$DISPLAY \ # -e QT_QPA_PLATFORM=xcb \ # -v /tmp/.X11-unix:/tmp/.X11-unix \ # artifact-editor artifact-editor # # Interactive shell: # docker run -it --rm artifact-editor bash