前边有简单介绍多earthly,以下是一个简单的试用
brew install buildkit
我使用的mac 系统,实际自己选择对应的系统
curl -s https://api.github.com/repos/vladaionescu/earthly/releases/latest | grep browser_download_url | grep darwin-amd64 | cut -d : -f 2- | tr -d \" | wget -P /usr/local/bin/ -i - && mv /usr/local/bin/earth-darwin-amd64 /usr/local/bin/earth && chmod +x /usr/local/bin/earth
方便语法高亮处理
ext install earthly.earthfile-syntax-highlighting
main.go
package main
?
import "fmt"
?
func main() {
fmt.Println("hello world")
}
FROM golang:1.13-alpine3.11
WORKDIR /go-example
?
build:
COPY main.go .
RUN go build -o build/go-example main.go
SAVE ARTIFACT build/go-example /go-example AS LOCAL build/go-example
?
docker:
COPY +build/go-example .
ENTRYPOINT ["/go-example/go-example"]
SAVE IMAGE go-example:latest
earth +build
or:
earth +docker
构建结果
发现很好的利用了cache,还是很快的
https://docs.earthly.dev/guides/basics
https://github.com/moby/buildkit
https://github.com/vladaionescu/earthly
原文:https://www.cnblogs.com/rongfengliang/p/12742401.html