# kaushal1014/docksmith-mktp architecture

> Architecture diagram of the GitHub repository kaushal1014/docksmith-mktp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaushal1014/docksmith-mktp
- Repository: https://github.com/kaushal1014/docksmith-mktp

## Overview

Docksmith is a small container-image builder and runner. The primary workflow parses a Docksmithfile, executes its build instructions against a local base image and build context, stores content-addressed layers and a manifest, then assembles those layers and runs a command in an isolated chroot. It also supports image listing/removal and build-layer caching. The README is empty; the graph reflects the sampled source, so it does not assume an external registry or base-image import workflow.

Main entry points: [`main.go`](https://github.com/kaushal1014/docksmith-mktp/blob/main/main.go) (Command dispatch), [`builder.go`](https://github.com/kaushal1014/docksmith-mktp/blob/main/builder.go) (Build orchestrator), [`image.go`](https://github.com/kaushal1014/docksmith-mktp/blob/main/image.go) (Image manifests), [`fs.go`](https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go) (Root filesystem assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI"]
  node_cli["Command dispatch<br/>[main.go]"]
end

subgraph group_build["Image building"]
  node_parser["Instruction parser<br/>[parser.go]"]
  node_builder["Build orchestrator<br/>[builder.go]"]
  node_context["Build context"]
  node_filesystem["Context and layer filesystem<br/>[fs.go]"]
  node_snapshot["Filesystem snapshots<br/>[snapshot.go]"]
end

subgraph group_storage["Image storage"]
  node_layerwriter["Layer creation<br/>[layer.go]"]
  node_cache[("Build cache<br/>[cache.go]")]
  node_manifest[("Image manifests<br/>[image.go]")]
  node_state["Local state directories<br/>[state.go]"]
  node_baseimage["Local base-image tar<br/>[fs.go]"]
end

subgraph group_runtime["Container runtime"]
  node_assembler["Root filesystem assembly<br/>[fs.go]"]
  node_environment["Runtime environment<br/>[builder.go]"]
  node_chroot["Isolated command runner<br/>[run.go]"]
end

node_user(("CLI user"))

node_user -->|"issues commands"| node_cli
node_cli -->|"initializes state"| node_state
node_cli -->|"parses build file"| node_parser
node_cli -->|"executes build"| node_builder
node_context -->|"provides instructions"| node_parser
node_context -->|"provides build files"| node_builder
node_builder -->|"loads base image"| node_baseimage
node_builder -->|"resolves and copies"| node_filesystem
node_builder -->|"checks and stores keys"| node_cache
node_builder -->|"compares RUN changes"| node_snapshot
node_builder -->|"creates instruction layers"| node_layerwriter
node_builder -->|"loads build metadata"| node_manifest
node_cli -->|"saves built image"| node_manifest
node_cli -->|"lists or removes images"| node_manifest
node_cli -->|"loads image for run"| node_manifest
node_cli -->|"assembles root filesystem"| node_assembler
node_manifest -->|"provides layer list"| node_assembler
node_assembler -->|"extracts each layer"| node_filesystem
node_cli -->|"builds runtime environment"| node_environment
node_cli -->|"runs selected command"| node_chroot
node_environment -->|"supplies environment"| node_chroot

click node_cli "https://github.com/kaushal1014/docksmith-mktp/blob/main/main.go"
click node_parser "https://github.com/kaushal1014/docksmith-mktp/blob/main/parser.go"
click node_builder "https://github.com/kaushal1014/docksmith-mktp/blob/main/builder.go"
click node_filesystem "https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go"
click node_snapshot "https://github.com/kaushal1014/docksmith-mktp/blob/main/snapshot.go"
click node_layerwriter "https://github.com/kaushal1014/docksmith-mktp/blob/main/layer.go"
click node_cache "https://github.com/kaushal1014/docksmith-mktp/blob/main/cache.go"
click node_manifest "https://github.com/kaushal1014/docksmith-mktp/blob/main/image.go"
click node_state "https://github.com/kaushal1014/docksmith-mktp/blob/main/state.go"
click node_baseimage "https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go"
click node_assembler "https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go"
click node_environment "https://github.com/kaushal1014/docksmith-mktp/blob/main/builder.go"
click node_chroot "https://github.com/kaushal1014/docksmith-mktp/blob/main/run.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_user toneBlue
class node_parser,node_builder,node_context,node_filesystem,node_snapshot toneAmber
class node_layerwriter,node_cache,node_manifest,node_state,node_baseimage toneMint
class node_assembler,node_environment,node_chroot toneRose
```

## Components

### CLI

- [Command dispatch](https://github.com/kaushal1014/docksmith-mktp/blob/main/main.go): `main.go`

### Image building

- [Instruction parser](https://github.com/kaushal1014/docksmith-mktp/blob/main/parser.go): `parser.go`
- [Build orchestrator](https://github.com/kaushal1014/docksmith-mktp/blob/main/builder.go): `builder.go`
- **Build context**
- [Context and layer filesystem](https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go): `fs.go`
- [Filesystem snapshots](https://github.com/kaushal1014/docksmith-mktp/blob/main/snapshot.go): `snapshot.go`

### Image storage

- [Layer creation](https://github.com/kaushal1014/docksmith-mktp/blob/main/layer.go): `layer.go`
- [Build cache](https://github.com/kaushal1014/docksmith-mktp/blob/main/cache.go): `cache.go`
- [Image manifests](https://github.com/kaushal1014/docksmith-mktp/blob/main/image.go): `image.go`
- [Local state directories](https://github.com/kaushal1014/docksmith-mktp/blob/main/state.go): `state.go`
- [Local base-image tar](https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go): `fs.go`

### Container runtime

- [Root filesystem assembly](https://github.com/kaushal1014/docksmith-mktp/blob/main/fs.go): `fs.go`
- [Runtime environment](https://github.com/kaushal1014/docksmith-mktp/blob/main/builder.go): `builder.go`
- [Isolated command runner](https://github.com/kaushal1014/docksmith-mktp/blob/main/run.go): `run.go`

### Other components

- **CLI user**

## Connections

- CLI user → Command dispatch: issues commands (evidence: `main.go`)
- Command dispatch → Local state directories: initializes state (evidence: `main.go`)
- Command dispatch → Instruction parser: parses build file (evidence: `main.go`)
- Command dispatch → Build orchestrator: executes build (evidence: `main.go`)
- Build context → Instruction parser: provides instructions
- Build context → Build orchestrator: provides build files (evidence: `builder.go`)
- Build orchestrator → Local base-image tar: loads base image (evidence: `builder.go`)
- Build orchestrator → Context and layer filesystem: resolves and copies (evidence: `builder.go`)
- Build orchestrator → Build cache: checks and stores keys (evidence: `builder.go`)
- Build orchestrator → Filesystem snapshots: compares RUN changes (evidence: `builder.go`)
- Build orchestrator → Layer creation: creates instruction layers (evidence: `builder.go`)
- Build orchestrator → Image manifests: loads build metadata (evidence: `builder.go`)
- Command dispatch → Image manifests: saves built image (evidence: `main.go`)
- Command dispatch → Image manifests: lists or removes images (evidence: `main.go`)
- Command dispatch → Image manifests: loads image for run (evidence: `main.go`)
- Command dispatch → Root filesystem assembly: assembles root filesystem (evidence: `main.go`)
- Image manifests → Root filesystem assembly: provides layer list
- Root filesystem assembly → Context and layer filesystem: extracts each layer (evidence: `fs.go`)
- Command dispatch → Runtime environment: builds runtime environment (evidence: `main.go`)
- Command dispatch → Isolated command runner: runs selected command (evidence: `main.go`)
- Runtime environment → Isolated command runner: supplies environment
