# kong/docker-kong architecture

> Architecture diagram of the GitHub repository kong/docker-kong, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kong/docker-kong
- Repository: https://github.com/kong/docker-kong

## Overview

##### Main Components

a) Build System Components:
- Kong Build Tools Pipeline
- Docker Image Building System
- Testing Framework
- CI/CD Integration

b) Image Variants:
- Ubuntu-based Image
- Debian-based Image (deb)
- RPM-based Image
- Alpine-based Image (apk)

c) Configuration Management:
- Docker Compose Setup
- Kong Configuration Layer
- Custom Plugins System

##### Specific Elements

- Blue: CI/CD components
- Green: Build system components
- Yellow: Configuration elements
- Red: Testing components
- Purple: Output artifacts

b) Component Relationships:

##### Key Workflows to Highlight

a) Image Building Pipeline:
**GitHub Actions → Kong Build Tools → Docker Build → Image Variants**

b) Testing Flow:
**Image Build → Test Suite → CIS Security Checks → Executable Verification**

c) Configuration Management:
**Base Image → Custom Plugins → Kong Config → Docker Compose**

##### Important Details to Capture

- Entry Points:
- Docker-entrypoint.sh locations
- Configuration injection points
- Plugin customization paths

- Testing Framework:
- Test categories from /tests
- Security scanning integration
- Plugin testing capabilities

- Build System:
- Kong-build-tools integration
- Package generation paths
- Version management flow

TOP: Development & CI
**GitHub Actions → Version Control → Automated Updates**

MIDDLE: Build & Test
**Kong Build Tools → Docker Build System → Test Suite**

BOTTOM: Artifacts & Distribution
**Image Variants → Package Distribution → Docker Hub Publication**

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "CI/CD Layer"
        GHA["GitHub Actions"]:::cicd
        VCS["Version Control"]:::cicd
        AUTO["Automated Updates"]:::cicd
    end

    subgraph "Build System Layer"
        KBT["Kong Build Tools"]:::build
        DBS["Docker Build System"]:::build
        TS["Test Suite"]:::test
        
        subgraph "Testing Components"
            CIS["CIS Security Checks"]:::test
            EV["Executable Verification"]:::test
            IT["Image Testing"]:::test
        end
        
        subgraph "Configuration"
            DC["Docker Compose"]:::config
            KC["Kong Configuration"]:::config
            CP["Custom Plugins"]:::config
        end
    end

    subgraph "Artifacts Layer"
        subgraph "Image Variants"
            UBI["Ubuntu Image"]:::artifact
            DBI["Debian Image"]:::artifact
            RPMI["RPM Image"]:::artifact
        end
        
        subgraph "Packages"
            APK["APK Package"]:::artifact
            DEB["DEB Package"]:::artifact
            RPM["RPM Package"]:::artifact
        end
    end

    %% Relationships
    GHA --> KBT
    VCS --> KBT
    AUTO --> KBT

    KBT --> DBS
    DBS --> TS
    
    TS --> CIS
    TS --> EV
    TS --> IT
    
    DBS --> DC
    DBS --> KC
    DBS --> CP
    
    DBS --> UBI
    DBS --> DBI
    DBS --> RPMI
    
    UBI --> APK
    DBI --> DEB
    RPMI --> RPM

    %% Click Events
    click KBT "https://github.com/Kong/docker-kong/tree/master/kong-build-tools/"
    click GHA "https://github.com/Kong/docker-kong/tree/master/.github/workflows/"
    click TS "https://github.com/Kong/docker-kong/tree/master/tests/"
    click CIS "https://github.com/Kong/docker-kong/blob/master/tests/03-cis-sec.test.sh"
    click EV "https://github.com/Kong/docker-kong/blob/master/tests/04-executables.test.sh"
    click IT "https://github.com/Kong/docker-kong/blob/master/tests/01-image.test.sh"
    click UBI "https://github.com/Kong/docker-kong/tree/master/ubuntu/Dockerfile"
    click DBI "https://github.com/Kong/docker-kong/blob/master/Dockerfile.deb"
    click RPMI "https://github.com/Kong/docker-kong/blob/master/Dockerfile.rpm"
    click DC "https://github.com/Kong/docker-kong/blob/master/compose/docker-compose.yml"
    click KC "https://github.com/Kong/docker-kong/blob/master/compose/config/kong.yaml"
    click CP "https://github.com/Kong/docker-kong/tree/master/customize/"
    click APK "https://github.com/Kong/docker-kong/blob/master/kong.apk.tar.gz"
    click DEB "https://github.com/Kong/docker-kong/blob/master/kong.deb"
    click RPM "https://github.com/Kong/docker-kong/blob/master/kong.rpm"

    %% Styles
    classDef cicd fill:#4299e1,stroke:#2b6cb0,stroke-width:2px
    classDef build fill:#48bb78,stroke:#2f855a,stroke-width:2px
    classDef test fill:#f56565,stroke:#c53030,stroke-width:2px
    classDef config fill:#ecc94b,stroke:#b7791f,stroke-width:2px
    classDef artifact fill:#9f7aea,stroke:#6b46c1,stroke-width:2px
```
