[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEA5R1GG37TFDV8JPCSH4J":3,"skill-same:01M6FEA5R1GG37TFDV8JPCSH4J":47},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M6FEA5R1GG37TFDV8JPCSH4J","dockerfile-optimise",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fdockerfile-optimise\u002FSKILL.md",[],[18,19],"dockerfile","dockerfile optimise","2026-11-10 10:12:30",false,"# Dockerfile Optimization Best Practices\n\nComprehensive Dockerfile optimization guide sourced exclusively from official Docker documentation. Contains 48 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.\n\n## When to Apply\n\nReference these guidelines when:\n- Writing new Dockerfiles or modifying existing ones\n- Optimizing Docker build times (layer caching, cache mounts, context management)\n- Reducing Docker image size (multi-stage builds, minimal base images)\n- Hardening container security (secret mounts, non-root users, attestations)\n- Setting up CI\u002FCD pipelines with Docker builds\n- Reviewing Dockerfiles for anti-patterns\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Layer Caching & Ordering | CRITICAL | `cache-` |\n| 2 | Multi-Stage Builds | CRITICAL | `stage-` |\n| 3 | Base Image Selection | HIGH | `base-` |\n| 4 | Build Context Management | HIGH | `ctx-` |\n| 5 | Security & Secrets | HIGH | `sec-` |\n| 6 | Dependency Management | MEDIUM-HIGH | `dep-` |\n| 7 | Instruction Patterns | MEDIUM | `inst-` |\n| 8 | Quality & Validation | MEDIUM | `lint-` |\n\n## Quick Reference\n\n### 1. Layer Caching & Ordering (CRITICAL)\n\n- [`cache-layer-order`](references\u002Fcache-layer-order.md) - Order layers by change frequency\n- [`cache-copy-deps-first`](references\u002Fcache-copy-deps-first.md) - Copy dependency files before source code\n- [`cache-copy-link`](references\u002Fcache-copy-link.md) - Use COPY --link for cache-efficient layer copying\n- [`cache-mount-package`](references\u002Fcache-mount-package.md) - Use cache mounts for package managers\n- [`cache-apt-combine`](references\u002Fcache-apt-combine.md) - Combine apt-get update with install\n- [`cache-external`](references\u002Fcache-external.md) - Use external cache for CI\u002FCD builds\n- [`cache-invalidation`](references\u002Fcache-invalidation.md) - Avoid unnecessary cache invalidation\n- [`cache-minimize-layers`](references\u002Fcache-minimize-layers.md) - Consolidate related RUN instructions\n\n### 2. Multi-Stage Builds (CRITICAL)\n\n- [`stage-separate-build-runtime`](references\u002Fstage-separate-build-runtime.md) - Separate build and runtime stages\n- [`stage-named-stages`](references\u002Fstage-named-stages.md) - Use named build stages\n- [`stage-parallel-branches`](references\u002Fstage-parallel-branches.md) - Exploit parallel stage execution\n- [`stage-target-builds`](references\u002Fstage-target-builds.md) - Use target builds for dev\u002Fprod\n- [`stage-copy-artifacts-only`](references\u002Fstage-copy-artifacts-only.md) - Copy only final artifacts between stages\n- [`stage-reusable-base`](references\u002Fstage-reusable-base.md) - Create reusable base stages\n\n### 3. Base Image Selection (HIGH)\n\n- [`base-minimal-image`](references\u002Fbase-minimal-image.md) - Use minimal base images\n- [`base-official-images`](references\u002Fbase-official-images.md) - Use Docker Official Images\n- [`base-pin-versions`](references\u002Fbase-pin-versions.md) - Pin base image versions with digests\n- [`base-arg-version`](references\u002Fbase-arg-version.md) - Use ARG before FROM to parameterize base images\n- [`base-rebuild-regularly`](references\u002Fbase-rebuild-regularly.md) - Rebuild images regularly with --pull\n- [`base-distroless`](references\u002Fbase-distroless.md) - Use distroless or scratch images for production\n\n### 4. Build Context Management (HIGH)\n\n- [`ctx-dockerignore`](references\u002Fctx-dockerignore.md) - Use .dockerignore to exclude unnecessary files\n- [`ctx-bind-mounts`](references\u002Fctx-bind-mounts.md) - Use bind mounts instead of COPY for build-only files\n- [`ctx-minimize-context`](references\u002Fctx-minimize-context.md) - Keep build context small\n- [`ctx-syntax-directive`](references\u002Fctx-syntax-directive.md) - Use syntax directive for latest BuildKit features (prerequisite for cache mounts, secret mounts, heredocs, COPY --link)\n\n### 5. Security & Secrets (HIGH)\n\n- [`sec-secret-mounts`](references\u002Fsec-secret-mounts.md) - Use secret mounts for sensitive data\n- [`sec-non-root-user`](references\u002Fsec-non-root-user.md) - Run as non-root user\n- [`sec-no-secrets-in-args`](references\u002Fsec-no-secrets-in-args.md) - Never pass secrets via ARG or ENV\n- [`sec-ssh-mounts`](references\u002Fsec-ssh-mounts.md) - Use SSH mounts for private repository access\n- [`sec-attestations`](references\u002Fsec-attestations.md) - Enable SBOM and provenance attestations\n- [`sec-no-unnecessary-packages`](references\u002Fsec-no-unnecessary-packages.md) - Avoid installing unnecessary packages\n- [`sec-ephemeral-containers`](references\u002Fsec-ephemeral-containers.md) - Design ephemeral, stateless containers\n\n### 6. Dependency Management (MEDIUM-HIGH)\n\n- [`dep-cache-mount-apt`](references\u002Fdep-cache-mount-apt.md) - Use cache mount for apt package manager\n- [`dep-cache-mount-npm`](references\u002Fdep-cache-mount-npm.md) - Use cache mount for npm, yarn, and pnpm\n- [`dep-cache-mount-pip`](references\u002Fdep-cache-mount-pip.md) - Use cache mount for pip\n- [`dep-version-pin`](references\u002Fdep-version-pin.md) - Pin package versions for reproducibility\n- [`dep-cleanup-caches`](references\u002Fdep-cleanup-caches.md) - Clean package manager caches in the same layer\n\n### 7. Instruction Patterns (MEDIUM)\n\n- [`inst-json-cmd`](references\u002Finst-json-cmd.md) - Use JSON form for CMD and ENTRYPOINT\n- [`inst-healthcheck`](references\u002Finst-healthcheck.md) - Define HEALTHCHECK for container orchestration\n- [`inst-heredoc-scripts`](references\u002Finst-heredoc-scripts.md) - Use heredocs for multi-line scripts\n- [`inst-entrypoint-exec`](references\u002Finst-entrypoint-exec.md) - Use exec in entrypoint scripts\n- [`inst-workdir-absolute`](references\u002Finst-workdir-absolute.md) - Use absolute paths with WORKDIR\n- [`inst-copy-over-add`](references\u002Finst-copy-over-add.md) - Prefer COPY over ADD\n\n### 8. Quality & Validation (MEDIUM)\n\n- [`lint-build-checks`](references\u002Flint-build-checks.md) - Enable Docker build checks\n- [`lint-pipefail`](references\u002Flint-pipefail.md) - Use pipefail for piped RUN commands\n- [`lint-labels`](references\u002Flint-labels.md) - Use standard labels for image metadata\n- [`lint-sort-arguments`](references\u002Flint-sort-arguments.md) - Sort multi-line arguments alphabetically\n- [`lint-single-concern`](references\u002Flint-single-concern.md) - One concern per container\n\n## How to Use\n\nRead individual reference files for detailed explanations and code examples:\n\n- [Section definitions](references\u002F_sections.md) - Category structure and impact levels\n- [Rule template](assets\u002Ftemplates\u002F_template.md) - Template for adding new rules\n\n## Reference Files\n\n| File | Description |\n|------|-------------|\n| [references\u002F_sections.md](references\u002F_sections.md) | Category definitions and ordering |\n| [assets\u002Ftemplates\u002F_template.md](assets\u002Ftemplates\u002F_template.md) | Template for new rules |\n| [metadata.json](metadata.json) | Version and reference information |\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fdockerfile-optimise",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill dockerfile-optimise",{"tool":39,"command":40},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill dockerfile-optimise",{"tool":42,"command":43},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill dockerfile-optimise","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fdockerfile-optimise\u002FSKILL.md",true,[],[48,62,72,81,87,94],{"skillNo":49,"name":50,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":58,"publishedAt":20},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[53],{"categoryNo":54,"categoryName":55,"taxonomyType":56,"taxonomyTypeDesc":57},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[59,60,61],"model","model hierarchy","model hierarchy skill",{"skillNo":63,"name":64,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":68,"publishedAt":20},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[67],{"categoryNo":54,"categoryName":55,"taxonomyType":56,"taxonomyTypeDesc":57},[69,70,71],"MCP","zoom","zoom mcp",{"skillNo":73,"name":74,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":20},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[78,79,80,70],"sdk","zoom apps sdk","apps",{"skillNo":82,"name":83,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":20},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[83],{"skillNo":88,"name":89,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":93,"publishedAt":20},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[92],{"categoryNo":54,"categoryName":55,"taxonomyType":56,"taxonomyTypeDesc":57},[89],{"skillNo":95,"name":96,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[96]]