跳到正文
Skillpedia
部署与云(DevOps)41k · #6811

depot-container-builds

它能做什么

本技能指导智能体使用 Depot 构建容器镜像,而不是本地 Docker 环境。适合把应用打包成 Docker 镜像的开发者。

适用场景

  • ✓当你需要在 Depot 远程构建器上构建 Docker 镜像时。
  • ✓当你希望为 Intel 和 ARM 电脑构建同一个镜像的时候。
  • ✓当容器构建失败,你需要修复问题或加快缓存速度的时候。

技能链接

https://github.com/PostHog/posthog/blob/master/.agents/skills/depot-container-builds/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/.agents/skills/depot-container-builds/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我用 Depot 为 Intel 和 ARM 芯片构建应用的 Docker 镜像,并推送到我的镜像仓库。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体使用 Depot 的构建命令代替常规的 Docker 构建命令。构建在远程机器上运行,并自动缓存;智能体可以加载、推送或保存镜像。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Depot Container Builds

Depot runs Docker image builds on remote high-performance builders (16 CPU, 32 GB RAM, NVMe SSD cache). depot build is a drop-in replacement for docker build / docker buildx build. depot bake replaces docker buildx bake.

<!-- PostHog-local section. Keep it when resyncing from upstream; see UPSTREAM.md. -->

Before you propose a change to CI, check things already tried for the idea. It records what was measured, and why some good-sounding changes were reverted or rejected.

<!-- End PostHog-local section. -->

Project Selection for Multi-Org Users

Container build commands target a specific project, not an organization. If expected projects aren't visible or a build unexpectedly prompts to select a project, the current default org may be wrong:

depot org show              # Current org ID
depot org list              # Orgs the user belongs to
depot org switch <org-id>   # Optional: set default org

Key Concepts

  • Builds run remotely on ephemeral EC2 instances — images stay in remote cache by default
  • Use --load to download to local Docker, --push to push to a registry, --save to store in Depot's ephemeral registry
  • Cache is fully automatic on persistent NVMe SSDs — no manual cache config needed
  • Multi-platform builds use native CPU builders (no QEMU emulation) for amd64 and arm64 simultaneously
  • All team members on a project share the same layer cache

depot build — Essential Patterns

# Build remotely (image stays in remote cache)
depot build -t repo/image:tag .

# Build + download to local Docker daemon
depot build -t repo/image:tag . --load

# Build + push directly to registry (fast — doesn't route through local network)
depot build -t repo/image:tag . --push

# Multi-platform build (native CPUs, no emulation)
depot build --platform linux/amd64,linux/arm64 -t repo/image:tag . --push

# Save to Depot ephemeral registry (7-day default, configurable per repository)
depot build --save .
depot build --save --save-tag my-tag .

# Suppress provenance metadata (fixes "unknown/unknown" platform in registries)
depot build -t repo/image:tag --push --provenance=false .

# Lint Dockerfile before building
depot build -t repo/image:tag . --lint

# Build with secrets
depot build --secret id=mysecret,src=./secret.txt -t repo/image:tag .

# Build with SSH forwarding
depot build --ssh default -t repo/image:tag .

# Specify a Depot project explicitly
depot build --project <project-id> -t repo/image:tag .

Key Flags

Flag Description
--load Download image to local Docker daemon
--push Push to registry
--save Save to Depot ephemeral registry
--save-tag Custom tag for Depot Registry
--platform Target platforms: linux/amd64, linux/arm64 (native, no emulation), plus linux/arm/v6, linux/arm/v7, linux/386
--build-platform Force build to run on specific arch (dynamic default)
--project Depot project ID
--token Depot API token
--lint Lint Dockerfile before build
--provenance Control provenance attestation (set false to fix unknown/unknown)
--sbom Generate an SBOM attestation (shorthand for --attest type=sbom)
--sbom-dir D
常见问题

它能替代 docker build 吗?

可以。本技能说明 depot build 可直接替代 docker build,depot bake 替代 docker buildx bake。

镜像最终会放在哪里?

根据所选选项,本技能可以将镜像加载到本地 Docker、推送到镜像仓库,或保存到 Depot 的镜像仓库。

我需要设置缓存吗?

不需要。本技能说明,Depot 的构建器会自动缓存。

详情

作者的原始描述

Configures and runs Depot remote container builds using `depot build` and `depot bake`. Use when building Docker images, creating Dockerfiles with Depot, pushing images to registries, building multi-platform/multi-arch images (linux/amd64, linux/arm64), debugging container build failures, optimizing Dockerfile layer caching, using docker-bake.hcl or docker-compose builds, or migrating from `docker build` / `docker buildx build` to Depot. Also use when the user mentions depot build, depot bake, container builds, image builds, or asks about Depot's build cache, build parallelism, build autoscali

repo: PostHog/posthog

热度

GitHub 星标
41k
排名
#6811
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能