# okazakee/dockercraft architecture

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

- Interactive diagram: https://gitdiagram.com/okazakee/dockercraft
- Repository: https://github.com/okazakee/dockercraft

## Overview

##### Project Components
- Docker Configuration: The core of the project is the Docker setup. You have a Dockerfile at the top level and a shell script (mcserver.sh) which likely manages runtime behavior.
- CI/CD & GitHub Workflows: The .github directory contains issue templates and several workflows (e.g., docker publishing, release changelog, etc.), indicating automated build, test, and release processes.
- Documentation & Contribution Guides: Files like README.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md, SECURITY.md, and changelog.md provide context for community and operational guidelines.
- Environment & Runtime Options: The README not only documents how to use docker run and docker-compose but also lists the environment variables (SERVER_PROVIDER, LAZYMC_VERSION, MC_VERSION, SERVER_BUILD, MC_RAM, JAVA_OPTS, and RUN_COMMAND) which indicate high customizability.

##### Main Components
a. Docker Image & Container:
- Docker image as a central container node.
b. Environment Configuration:
- How these variables trigger different operational modes within the container.
c. Server Provider:
- Connection to the actual Minecraft server binary – the image supports multiple providers (Vanilla, Paper, etc.).
- A component (or parameterized sub-component) that captures this selection.
d. Lazymc Integration:
- A distinct component for Lazymc which monitors the server’s activity (idleness) and starts or stops components as needed.
- “wake on player join” and “rest when idle” functionality.
e. Storage & Volume Mounting:
f. CI/CD Pipeline:
- Components representing GitHub Workflows and release automation.
- Although not part of runtime, these build and deployment pipelines are important for understanding the project lifecycle.
g. External Services:
- Briefly note external integrations like Docker Hub (for image hosting) and the GitHub repository page where community contributions occur.

##### Relationships and Interactions
- If including CI/CD, indicate a flow from GitHub (commit pushes, issues) through the workflow automation that triggers Docker builds, tests, and deployments.

##### Architectural Patterns and Design Principles
- Containerization: Emphasize that the entire server is isolated within a Docker container.
- Configuration via Environment Variables: Make it clear that runtime behavior is easily configurable without modifying the image.
- Modularity and Extensibility: The project is modular—users can specify the server provider and additional custom run commands to use their own server jars or scripts.
- CI/CD Automation: The usage of GitHub workflows points to automated testing, building, and publishing – a best practice for continuous integration and deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD & Documentation Subgraph
    subgraph "CI/CD & Documentation"
        WF["GitHub Workflows (.github/workflows)"]:::cicd
        IT["Issue Templates (.github/ISSUE_TEMPLATE)"]:::cicd
        RD["README.md"]:::docs
        CC["CODE_OF_CONDUCT.md"]:::docs
        CN["CONTRIBUTING.md"]:::docs
        ST["SECURITY.md"]:::docs
        CH["changelog.md"]:::docs
    end

    %% Docker Configuration Subgraph
    subgraph "Docker Configuration"
        DF["Dockerfile"]:::docker
        MS["mcserver.sh"]:::docker
    end

    %% DockerCraft and Internal Services
    DCI["DockerCraft Image"]:::runtime
    LM["Lazymc Service (Idle Management)"]:::runtime
    MSP["Minecraft Server Provider Options (Vanilla,Paper,Purpur,Fabric,Forge)"]:::runtime

    %% External Configuration Nodes
    ENV["Environment Variables (SERVER_PROVIDER,LAZYMC_VERSION,MC_VERSION,SERVER_BUILD,MC_RAM,JAVA_OPTS,RUN_COMMAND)"]:::config
    VOL["Persistent Volume (/mcserver)"]:::storage
    NET["Network Ports Mapping (25565,25575)"]:::network

    %% Connections from CI/CD & Docs to DockerCraft Image
    WF -->|"triggers_build"| DCI
    IT -->|"tracks_issues"| DCI
    RD --> DCI
    CC --> DCI
    CN --> DCI
    ST --> DCI
    CH --> DCI

    %% Connections from Docker Configuration to DockerCraft Image
    DF -->|"build_context"| DCI
    MS -->|"runtime_script"| DCI

    %% Connections from External Configurations to DockerCraft Image
    ENV --> DCI
    VOL --> DCI
    NET --> DCI

    %% Internal Components within the DockerCraft Image
    DCI -->|"runs"| LM
    DCI -->|"includes"| MSP

    %% Styling Classes
    classDef runtime fill:#ccf,stroke:#333,stroke-width:2px;
    classDef docker fill:#fcf,stroke:#333,stroke-width:2px;
    classDef cicd fill:#cfc,stroke:#333,stroke-width:2px;
    classDef docs fill:#ffc,stroke:#333,stroke-width:2px;
    classDef config fill:#eef,stroke:#333,stroke-width:2px;
    classDef storage fill:#efe,stroke:#333,stroke-width:2px;
    classDef network fill:#fee,stroke:#333,stroke-width:2px;

    %% Click Events
    click DF "https://github.com/okazakee/dockercraft/tree/master/Dockerfile"
    click MS "https://github.com/okazakee/dockercraft/blob/master/mcserver.sh"
    click WF "https://github.com/okazakee/dockercraft/tree/master/.github/workflows"
    click IT "https://github.com/okazakee/dockercraft/tree/master/.github/ISSUE_TEMPLATE"
    click RD "https://github.com/okazakee/dockercraft/blob/master/README.md"
    click CC "https://github.com/okazakee/dockercraft/blob/master/CODE_OF_CONDUCT.md"
    click CN "https://github.com/okazakee/dockercraft/blob/master/CONTRIBUTING.md"
    click ST "https://github.com/okazakee/dockercraft/blob/master/SECURITY.md"
    click CH "https://github.com/okazakee/dockercraft/blob/master/changelog.md"
```
