当前位置:网站首页>Earthly container image construction tool -- the road to dream

Earthly container image construction tool -- the road to dream

2022-06-24 08:44:00 The road to dream

Makefile + Dockerfile = Earthfile

In the use of Earthly Currently, when building images, it is strongly dependent on buildkit,Earthly adopt buildkit Supported some Dockerfile   Extended syntax for , At the same time Dockerfile And Makefile Integrate , Make multi platform construction and coding Dockerfile Make it easier ; Use  Earthly It can be completed more conveniently Dockerfile Code reuse and more friendly CI Automatic integration .

#  install 

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'

 After installation  Earthly  Will start a  buildkitd  Containers : earthly-buildkitd

#  Example 

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

#  Directory structure 
~/t/earthlytest *** tree
.
├── Earthfile
└── main.go

0 directories, 2 files

#  adopt  earthly  Build 
~/t/earthlytest *** earthly +docker

I'll summarize later  

  More powerful container image building tools Earthly

GitHub - earthly/earthly: The effortless CI/CD framework that runs anywhere

Get Earthly - Better Builds 

原网站

版权声明
本文为[The road to dream]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240622199285.html