Earthly(1.2万星)构建框架2026:用熟悉的Dockerfile语法做可重复构建

📘 教程 2026-08-06 约 4 分钟阅读

Earthly(12,047星)把类Dockerfile语法带到构建和CI:可重复、可并行、缓存友好。本文教你如何把Makefile项目迁移到Earthly。

💡 你将学到

Earthly(12,047星)把类Dockerfile语法带到构建和CI:可重复、可并行、缓存友好。本文教你如何把Makefile项目迁移到Earthly。

📜 目录

直接给结论

earthly/earthly(12,047星,Go)是一个让构建更快、更可重复、更CI友好的构建框架。语法和Dockerfile类似,懂Docker几乎零学习成本。每个target在隔离环境里运行,笔记本和CI里的构建行为完全一致。

核心概念

示例Earthfile

VERSION 0.8
FROM python:3.12
WORKDIR /src

build:
    COPY requirements.txt ./
    RUN pip install -r requirements.txt
    COPY . .
    SAVE ARTIFACT . /build

test:
    FROM +build
    RUN pytest tests/

运行:

# 安装
curl -L https://earthly.dev/get | sh
# 构建和测试
earthly +build
earthly +test

为什么团队从Makefile迁移

FAQ

免费吗? 是——Earthly开源(MPL-2.0),云功能可选付费。

能替代Docker构建吗? 是互补关系:Earthly构建镜像和产物,可推送到任意镜像仓库。

支持GitHub Actions吗? 支持——有官方GitHub Action(earthly/earthly-action)。

相关文章

❓ 常见问题

Is it free?

Yes - Earthly is open source (MPL-2.0), with optional paid cloud features.

Can it replace Docker builds?

It complements them: Earthly builds images and artifacts, and can push to any registry.

Does it work with GitHub Actions?

Yes - there is a GitHub Action (`earthly/earthly-action`) that runs Earthly in CI.

相关文章
2026-07-17
AI Agent JWT认证:无状态API认证
2026-08-07
AI网页爬虫Agent:用browser-use打造会自我纠错的爬虫
2026-08-13
开源 AI 有声书生成器 2026:自托管 TTS 朗读你的书库

本站文章由编辑人工撰写,收录的工具均经过实测或公开资料核验。文中链接指向工具官网或 GitHub 仓库,仅作信息参考,不构成付费推广。

💬 评论 (0)

暂无评论,来说两句吧~

登录后评论