当前位置:网站首页>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
边栏推荐
- ZUCC_ Principles of compiling language and compilation_ Experiment 04 language and grammar
- leetcode 1268. Search Suggestions System(搜索推荐系统)
- Introduction to RCNN, fast RCNN and fast RCNN
- win11在cmder中使用vim查看内容的时候空白
- ZUCC_ Principles of compiling language and compilation_ Experiment 03 getting started with compiler
- 中国芯片独角兽公司
- Shell array
- Fund raising, trading and registration
- ZUCC_编译语言原理与编译_实验02 FSharp OCaml语言
- 分布式 | 如何与 DBLE 进行“秘密通话”
猜你喜欢

2021-03-09 comp9021 class 7 Notes

表单图片上传在Chorme中无法查看请求体的二进制图片信息

ZUCC_编译语言原理与编译_实验05 正则表达式、有限自动机、词法分析

Redis cluster data skew

Send custom events in QT

JUC personal simple notes

How to improve the customer retention rate in the operation of independent stations? Customer segmentation is very important!

uniapp 热更新后台管理

New technology practice, encapsulating the permission application library step by step with the activity results API

Vscode install the remote -wsl plug-in to connect to the local WSL
随机推荐
2021-06-25: a batch of strings consisting only of lowercase letters (a~z) are put
Glusterfs replacement failure brick
Rsync for file backup
Rust procedure macro simply imitates Lombok function
uniapp 热更新后台管理
IIS build wordpress5.7 manually
ZUCC_ Principles of compiling language and compilation_ Experiment 01 language analysis and introduction
Several ways you can't move zero (sequel)
Smart power plant: how to make use of easycvr to build a safe, stable, green and environment-friendly intelligent inspection platform
[acnoi2022] not a structure, more like a structure
JUC personal simple notes
数据库迁移从PostgreSQL迁移到 MYSQL
相机投影矩阵计算
Using ngrok for intranet penetration
jwt(json web token)
QTimer定时器不起作用的原因
定时备份数据库脚本
【力扣10天SQL入门】Day3
Shell pass parameters
Redis的Cluster集群数据倾斜