# tech-shrimp/docker_image_pusher architecture

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

- Interactive diagram: https://gitdiagram.com/tech-shrimp/docker_image_pusher
- Repository: https://github.com/tech-shrimp/docker_image_pusher

## Overview

##### Main Components
- GitHub Repository: Represents the source code and configuration. Include special nodes for:
- The .github/workflows directory (specifically docker.yaml) which scripts the automation.
- The images.txt file that contains the list of Docker images (input configuration).
- Documentation files (doc folder, images, and README).
- GitHub Actions Workflow Engine: The automation server that executes the docker.yaml. This component triggers on push events (for example, when images.txt is updated) or on a scheduled (cron) basis.
- External Docker Registries:
- Source registries such as DockerHub, gcr.io, k8s.io, and ghcr.io.
- Alibaba Cloud Container Registry: The target private registry where the images are pushed.
- Developer/User Interaction: A node representing how the developer initially forks the repository, configures the environment (secrets like ALIYUN_REGISTRY_USER, ALIYUN_REGISTRY_PASSWORD, etc.), and later monitors execution/output.

##### Relationships and Interactions
- When an update (e.g., commit to images.txt) or scheduled trigger occurs, the GitHub Actions workflow is launched.
- The workflow reads images.txt and processes the list of images. For each image, it:
- Pulls the image from the respective public registry.
- Authenticates to the Alibaba Cloud Container Registry using the environment secrets.
- Pushes (mirrors) the image to the Alibaba Cloud repository.
- The workflow may also handle parameters like image tag, optional platform settings (via --platform=xxx), or even handle images with duplicate names by adjusting the naming (adding namespace prefixes).
- The overall flow relies on secure interactions maintained via configured repository secrets.

##### Architectural Patterns and Design Principles
- This tool is a lightweight automation pipeline integrated directly into GitHub. Hence, its architecture isn’t split into multiple long-running services, but it does have a clear separation of concerns:
- Input configuration (images.txt)
- Processing “pipeline” (GitHub Actions which encapsulate the business logic)
- External integrations (source registries and target Alibaba Cloud Container Registry)
- That the design uses declarative workflow definitions (via YAML) and environment configuration (repository secrets) to manage integration and security.

##### Highlighted Technologies and Frameworks
- GitHub Actions / Workflows (for orchestration)
- Docker (for image pulling and pushing operations)
- Alibaba Cloud Container Registry (as the target service)
- Various public Docker image sources (DockerHub, GCR, etc.)
- (Optionally) Cron scheduling syntax as part of the workflow to trigger periodic tasks.

##### Specific Elements
- Initiation triggers (commit, schedule) → Start workflow.
- Workflow → Pull images from (DockerHub/gcr.io/…) → then push to “Alibaba Cloud Container Registry.”
- Automation engine (workflow engine) which may be represented as a process block.

## Diagram (Mermaid)

```mermaid
graph TD
    Developer["Developer/User"]:::developer
    Developer -->|"fork/configure"| Repo["GitHub Repository (Source Code & Configurations)"]:::repo

    subgraph "GitHub Repository Components"
        Workflow["GitHub Actions Workflow (.github/workflows/docker.yaml)"]:::workflow
        Config["Input Configuration (images.txt)"]:::config
        Docs["Documentation (doc folder & README.md)"]:::config
    end

    Config -->|"updates_trigger"| Workflow

    Workflow -->|"pull_image"| PublicReg["Public Docker Registries (DockerHub, gcr.io, k8s.io, ghcr.io)"]:::external
    PublicReg -->|"push_image"| Alibaba["Alibaba Cloud Container Registry"]:::cloud
    Workflow -->|"uses_secrets_for_auth"| Alibaba

    click Repo "https://github.com/tech-shrimp/docker_image_pusher/tree/main/Root directory"
    click Workflow "https://github.com/tech-shrimp/docker_image_pusher/blob/main/.github/workflows/docker.yaml"
    click Config "https://github.com/tech-shrimp/docker_image_pusher/blob/main/images.txt"
    click Docs "https://github.com/tech-shrimp/docker_image_pusher/tree/main/doc folder"

    classDef developer fill:#b3cde0,stroke:#005b96,stroke-width:2px;
    classDef repo fill:#ccebc5,stroke:#006400,stroke-width:2px;
    classDef workflow fill:#fbb4ae,stroke:#d95f02,stroke-width:2px;
    classDef config fill:#ffffcc,stroke:#ff8c00,stroke-width:2px;
    classDef external fill:#fddaec,stroke:#c51b8a,stroke-width:2px;
    classDef cloud fill:#e6e6fa,stroke:#9400d3,stroke-width:2px;
```
