شعار Hatch3r Containerize

Hatch3r Containerize

مؤسسة
hatch3r
hatch3r-containerize

Containerizes an application through a repeatable workflow — multi-stage Dockerfile, non-root hardening, minimal base image, .dockerignore, healthcheck, local docker-compose, Kubernetes manifest basics, and an image-scan gate. Use when adding or hardening container artifacts.

نظرة عامة

الناشرhatch3r
المستودعhatch3r
اسم المهارةhatch3r-containerize
النجوم
26
التفريعات
7
الملفات المرفقة
تعليمات فقط
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

  • مفتوحة المصدر

    نشرها hatch3r على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Hatch3r Containerize في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/hatch3r/hatch3r/tree/main/skills/hatch3r-containerize
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hatch3r/hatch3r.git /tmp/hatch3r
mkdir -p .claude/skills
cp -r /tmp/hatch3r/skills/hatch3r-containerize .claude/skills/hatch3r-containerize
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Hatch3r Containerize في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Hatch3r Containerize تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Hatch3r Containerize بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Containerization Workflow

Companion workflow to the hatch3r-devops agent: that agent reviews and authors infrastructure across CI/CD, IaC, and orchestration with apply-step gating; this skill is the focused step-by-step procedure for producing a hardened container image and its local + orchestration manifests. Use this skill when the task is "containerize this service" or "harden this Dockerfile"; escalate to the agent when the work spans pipelines, cloud IaC, or a deployment strategy.

Quick Start

Task Progress:
- [ ] Step 0: Detect ambiguity (P8 B1)
- [ ] Step 1: Pick a minimal base image + plan build/runtime split
- [ ] Step 2: Write the multi-stage Dockerfile
- [ ] Step 3: Harden — non-root USER, dropped privileges, HEALTHCHECK
- [ ] Step 4: Add .dockerignore + verify build context size
- [ ] Step 5: Author docker-compose for local dev
- [ ] Step 6: Author Kubernetes manifest with securityContext
- [ ] Step 7: Scan the image and gate on findings

Two invariants bound every image this workflow produces: it runs as a non-root user, and it ships only runtime artifacts (no build toolchain, no secrets). Steps 2–3 establish both; Step 7 verifies them.

Step 0 — Detect Ambiguity (P8 B1)

Before any work, scan the invocation for unresolved questions in scope, intent, acceptance criteria, target environment, or irreversibility. If any are found, ask the user via the platform-native question tool per agents/shared/user-question-protocol.md. Do not proceed under silent assumption. Default path, not an exception. Triggers for THIS skill: language/runtime + version (drives base-image choice), whether the target is local-dev-only or production orchestration, the orchestrator (plain Docker vs docker-compose vs Kubernetes), whether secrets are needed at build time vs runtime (build-time secrets are an irreversible leak risk), and the registry the final image pushes to.

Fan-out Discipline (P8 B2)

Fan-out scales with task size; token cost never justifies serializing independent work (rules/hatch3r-fan-out-discipline.md P8 B2; agents/shared/efficiency-patterns.md). Tier boundaries for THIS skill:

  • Tier 1 (one service, Dockerfile only): inline.
  • Tier 2 (Dockerfile + compose + one K8s manifest for one service): spawn one sub-agent per artifact via the Task tool.
  • Tier 3 (multi-service repo, one image set per service): one fresh sub-agent per service; orchestrator integrates the compose/manifest set only.

Emit sub_agents_spawned: { count, rationale, task_structure } in your output.

Step 1: Pick a Minimal Base Image and Plan the Build/Runtime Split

  • Choose the smallest base that runs the app: a -slim variant, a distroless image, or Alpine where the libc difference is acceptable. A smaller base shrinks attack surface and pull time (Docker best-practices — see References).
  • Plan two stages: a build stage that carries the full toolchain (compilers, dev dependencies, test runners) and a runtime stage that carries only the built artifact plus its runtime dependencies (Docker multi-stage — see References).
  • Pin the base image to a specific tag or digest (node:22.5.1-slim, not node:latest). A mutable tag makes the build non-reproducible.

Step 2: Write the Multi-Stage Dockerfile

Structure the Dockerfile so each FROM begins a stage and the final stage copies only the runtime output:

dockerfile
# --- build stage ---
FROM node:22.5.1-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev

# --- runtime stage ---
FROM node:22.5.1-slim AS runtime
WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
  • Order instructions stalest-to-freshest: copy the lockfile and install dependencies before copying source, so a code edit does not bust the dependency-install layer cache.
  • COPY --from=build only the artifacts the app needs at runtime — never the source tree, build cache, or dev dependencies.
  • Never write a secret into a layer. Use BuildKit build secrets (RUN --mount=type=secret,...) for build-time credentials and runtime environment injection for runtime credentials; a secret in any layer is recoverable from the image (OWASP Docker Security — see References).

Step 3: Harden — Non-Root, Dropped Privileges, Healthcheck

  • Create a dedicated unprivileged user with an explicit UID/GID and switch to it before the run command. An explicit UID survives rebuilds and maps to a Kubernetes runAsUser (Docker best-practices — see References):
dockerfile
RUN groupadd -r app --gid=10001 && useradd -r -g app --uid=10001 app
USER app
  • Running as root is the most common dangerous container misconfiguration: a container escape inherits host root (OWASP Docker Security — see References). The non-root USER line is mandatory output of this step.
  • Add a HEALTHCHECK so the orchestrator can detect and restart an unhealthy container — this is CIS Docker Benchmark control 4.6 (CIS — see References):
dockerfile
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
  CMD node ./dist/healthcheck.js || exit 1
  • Do not install sudo; its TTY and signal-forwarding behavior is unpredictable. If privilege elevation is unavoidable, use gosu (Docker best-practices — see References).
  • Use COPY not ADD (ADD's URL-fetch and auto-extract behavior is a footgun); set ENV NODE_ENV=production (or the runtime equivalent) so the app does not load dev tooling.

Step 4: Add .dockerignore and Verify Build Context Size

  • Author a .dockerignore excluding .git, node_modules (rebuilt in-image), .env*, test artifacts, CI config, and local build output. This keeps secrets out of the build context and shrinks the upload sent to the daemon.
  • A .env file reaching the build context is a credential-leak path even if a layer does not copy it — exclude it explicitly.
  • Verify: run the build and confirm the "transferring context" size is small (kilobytes, not the whole repo). A large context means the .dockerignore missed something.

Step 5: Author docker-compose for Local Dev

  • Write a docker-compose.yml (or compose.yaml) that builds the image and wires backing services (database, cache, queue) for local development.
  • Inject configuration via environment: / env_file: referencing a gitignored .env; never inline secrets in the compose file.
  • Add a healthcheck: per service and use depends_on: with condition: service_healthy so the app waits for its database to be ready.
  • Pin backing-service images to specific tags, mirroring the Dockerfile base-pin policy.
  • Mount source as a volume only in the local-dev compose, never in the production image build.

Step 6: Author the Kubernetes Manifest with securityContext

  • Author a Deployment + Service. Set a securityContext that enforces the Dockerfile hardening at the orchestrator layer (Kubernetes hardening — see References):
yaml
securityContext:
  runAsNonRoot: true
  runAsUser: 10001
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities:
    drop: ["ALL"]
  • Set resource requests and limits (CPU + memory) so a runaway container cannot starve the node.
  • Map the Dockerfile HEALTHCHECK to a readinessProbe and livenessProbe so Kubernetes gates traffic and restarts on the same signal.
  • Reference secrets via a Secret object or external secret store; never inline credentials in the manifest.
  • Drop all Linux capabilities and add back only what the workload requires (OWASP Docker Top 10 — see References).

Step 7: Scan the Image and Gate on Findings

  • Build the image, then scan it with a vulnerability scanner (Trivy, Grype, or docker scout) before pushing. Trivy also runs CIS Docker/Kubernetes benchmark checks (Trivy / CIS — see References).
  • Gate: block the push on any fixable HIGH or CRITICAL CVE. For an unfixable CVE with no upstream patch, record an explicit accepted-risk note with the CVE id and a re-check date rather than silently shipping.
  • Re-scan after a base-image bump — a new base introduces a new CVE set.
  • Optionally run a config linter (hadolint for the Dockerfile, Docker Bench for Security against the host) and surface findings alongside the CVE report.

Error Handling

  • Final image is unexpectedly large: confirm the runtime stage copies only artifacts (Step 2), the base is a -slim/distroless variant (Step 1), and .dockerignore excludes node_modules/build output (Step 4). A multi-hundred-MB image usually means the build toolchain leaked into the runtime stage.
  • App fails to start as non-root: the process is binding a privileged port (<1024) or writing to a path it no longer owns. Bind a high port and map it at the orchestrator, or chown the writable path to the app UID in the build stage. Do not revert to root.
  • readOnlyRootFilesystem: true breaks the app: mount an emptyDir volume at the specific writable path (cache, tmp) the app needs rather than disabling the read-only root.
  • Scanner reports a CVE with no fix: do not silently ship. Record the CVE id, affected package, and a re-evaluation date as an accepted-risk note; escalate if it is on the request path and exploitable.
  • Build needs a secret: never COPY or ARG it into a layer. Use a BuildKit secret mount (RUN --mount=type=secret); if that is unavailable, build the artifact outside the image and COPY only the result.

Definition of Done

  • Multi-stage Dockerfile: build stage and a runtime stage carrying only runtime artifacts
  • Runs as a non-root user with an explicit UID; no sudo; HEALTHCHECK present
  • Minimal pinned base image (no latest); .dockerignore verified to shrink the build context
  • docker-compose for local dev with per-service healthchecks and gitignored secret injection
  • Kubernetes manifest with securityContext (runAsNonRoot, dropped capabilities, read-only root), resource limits, and probes
  • Image scanned; build/push gated on fixable HIGH/CRITICAL CVEs; accepted-risk notes recorded for unfixable findings
  • No secret in any image layer, compose file, or manifest

References

  • Docker, Inc. "Building best practices — Dockerfile." https://docs.docker.com/build/building/best-practices/ (accessed 2026-06-02, Docker Docs, official-docs). Source for the minimal-base-image guidance (Step 1), the non-root USER with explicit UID and the no-sudo/gosu rule (Step 3), and COPY-over-ADD. Multi-stage build mechanics (Step 2): https://docs.docker.com/build/building/multi-stage/.
  • OWASP Foundation. "Docker Security Cheat Sheet." https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html (accessed 2026-06-02, OWASP, official-docs). Source for the drop-all-capabilities-then-add-back posture (Steps 6), the no-secrets-in-layers rule (Steps 2–4), and the root-escape blast-radius rationale behind the mandatory non-root user (Step 3). Container-environment controls: OWASP Docker Top 10 https://owasp.org/www-project-docker-top-10/.
  • Center for Internet Security / Aqua Security (Trivy). "CIS Docker Benchmark — HEALTHCHECK (control 4.6) and Trivy CIS benchmark scanning." https://www.cisecurity.org/benchmark/docker and https://www.aquasec.com/blog/trivy-kubernetes-cis-benchmark-scanning/ (accessed 2026-06-02, CIS official-docs + Aqua Security established-library). Source for the HEALTHCHECK requirement (Step 3), the Kubernetes securityContext hardening fields (Step 6), and the Trivy CIS-benchmark image-scan gate (Step 7).

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Hatch3r Containerize؟

Containerizes an application through a repeatable workflow — multi-stage Dockerfile, non-root hardening, minimal base image, .dockerignore, healthcheck, local docker-compose, Kubernetes manifest basics, and an image-scan gate. Use when adding or hardening container artifacts.

لماذا تستخدم Hatch3r Containerize على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Hatch3r Containerize عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Hatch3r Containerize في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/hatch3r/hatch3r/tree/main/skills/hatch3r-containerize. يقرأ TypingMind ملف SKILL.md الخاص بها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Hatch3r Containerize؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Hatch3r Containerize؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Hatch3r Containerize معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Hatch3r Containerize مجانية؟

نعم. نشرها hatch3r على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇