当前位置:网站首页>Earthly 容器镜像构建工具 —— 筑梦之路
Earthly 容器镜像构建工具 —— 筑梦之路
2022-06-24 07:05:00 【筑梦之路】

Makefile + Dockerfile = Earthfile
在使用 Earthly 进行构建镜像时目前强依赖于 buildkit,Earthly 通过 buildkit 支持了一些 Dockerfile 的扩展语法,同时将 Dockerfile 与 Makefile 整合,使得多平台构建和代码化 Dockerfile 变得更加简单;使用 Earthly 可以更加方便的完成 Dockerfile 的代码复用以及更加友好的 CI 自动集成。
# 安装
sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
安装完成后 Earthly 将会启动一个 buildkitd 容器: earthly-buildkitd
# 示例
cat main.go
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
cat Earthlyfile
FROM golang:1.17-alpine
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
# 目录结构
~/t/earthlytest *** tree
.
├── Earthfile
└── main.go
0 directories, 2 files
# 通过 earthly 进行构建
~/t/earthlytest *** earthly +docker
后续再总结
GitHub - earthly/earthly: The effortless CI/CD framework that runs anywhere
边栏推荐
- How to implement approval function in Tekton
- Rescue system -- the application of read-write separation
- 2021-06-24: find the length of the longest non repeating character substring in a string.
- 【无标题】
- 【生活思考】计划与自律
- 为什么ping不通,而traceroute却可以通
- Two methods of QT exporting PDF files
- How to improve the customer retention rate in the operation of independent stations? Customer segmentation is very important!
- Promise的使用場景
- How to configure networkpolicy for nodeport in kubernetes
猜你喜欢

uniapp 热更新后台管理

ZUCC_ Principles of compiling language and compilation_ Experiment 02 fsharp Ocaml language

Two methods of QT exporting PDF files

5分钟,客服聊天处理技巧,炉火纯青

分布式 | 如何与 DBLE 进行“秘密通话”

Maya re deployment

一文详解|增长那些事儿
![[explain the difference between operation and maintenance and network engineering]](/img/2b/945f468588e729336e2e973e777623.jpg)
[explain the difference between operation and maintenance and network engineering]

Send custom events in QT

ZUCC_编译语言原理与编译_实验04 语言与文法
随机推荐
String转Base64
Shell array
Win10 cloud, add Vietnamese
中国芯片独角兽公司
Redis的Cluster集群数据倾斜
[xinliu-s6 new model +sa 3-star Xinghai] the new two-way server of the third generation chip was launched and the product was updated~
Easydss anonymous live channel data volume instability optimization scheme sharing
dataX使用指南
Fund raising, trading and registration
PHP代码加密的几种方案
Tencent conference API - get rest API & webhook application docking information
[untitled]
Why do you want to file? What are the advantages and disadvantages of website filing?
单目双视三维坐标确定
ZUCC_编译语言原理与编译_实验08 语法分析 LR 分析
api平台通用签名机制
ZUCC_编译语言原理与编译_实验02 FSharp OCaml语言
Maya re deployment
The reason why the qtimer timer does not work
The JS macro of WPS implements the separation method of picture text in the same paragraph