Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
a83a28f40d
|
|||
20298898fb
|
|||
064cec5742
|
|||
33b60cea3b
|
|||
9ffb6b71bd
|
|||
d37a6bbc85
|
|||
ade5768001
|
|||
a24a7bdeca
|
|||
8099d55ce9
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
main
|
@@ -2,7 +2,7 @@ module ci
|
||||
|
||||
go 1.19
|
||||
|
||||
require git.front.kjuulh.io/kjuulh/dagger-go v0.0.9
|
||||
require git.front.kjuulh.io/kjuulh/dagger-go v0.0.18
|
||||
|
||||
require (
|
||||
dagger.io/dagger v0.3.1 // indirect
|
||||
|
14
ci/go.sum
14
ci/go.sum
@@ -41,6 +41,20 @@ git.front.kjuulh.io/kjuulh/dagger-go v0.0.8 h1:hbXEOYw3Q3sdwMjaEMz+v/TOnyUWSDAYF
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.8/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.9 h1:XxKhvUM8q7QcRSTeE7hF56zoXKGOncdHBdccKBKnS6M=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.9/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.10 h1:d9VNhI6OsiR/W4/1iJvchuHwTq2C3AHw3yetncKWfUM=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.10/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.11 h1:j3ylHiGmhcFomggJcrNJghbYBK/nuuvw0naFBIWqEqo=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.11/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.12 h1:c75Ac8joaOMfaOSPf+ZcvNdBcytx0hzIJMYXexKGXJ0=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.12/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.15 h1:jYFyZo2S3KPPo+eGd9TqRSqP3U5lqXXguP56STyklLA=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.15/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.16 h1:JP+K+4B3APG/bxKjAV3SHEkm2GSRgsDSeS3vT9fIqnU=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.16/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.17 h1:lo4bvPLwO3AhlMPJOoZnetLY66HSlw2rfCc2Mi1QV38=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.17/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.18 h1:asW/jEmf3HORb6nqgUldoLge/UjEFFnII0YjPYQ+Qg0=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.18/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
|
@@ -25,7 +25,7 @@ func main() {
|
||||
ImageName: "dagger-go",
|
||||
},
|
||||
BuildPath: "main.go",
|
||||
BinName: "dagger-go",
|
||||
BinName: "main",
|
||||
BaseImage: "harbor.front.kjuulh.io/docker-proxy/library/docker:dind",
|
||||
}).
|
||||
Execute(ctx)
|
||||
|
@@ -35,7 +35,6 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
var (
|
||||
bin dagger.FileID
|
||||
build *dagger.Container
|
||||
scratch *dagger.Container
|
||||
finalImage *dagger.Container
|
||||
)
|
||||
|
||||
@@ -66,28 +65,27 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
return err
|
||||
},
|
||||
},
|
||||
byg.Step{
|
||||
Execute: func(ctx byg.Context) error {
|
||||
if opts.BaseImage == "" {
|
||||
opts.BaseImage = "harbor.front.kjuulh.io/docker-proxy/library/busybox"
|
||||
}
|
||||
|
||||
scratch = container.LoadImage(client, opts.BaseImage)
|
||||
return nil
|
||||
},
|
||||
},
|
||||
).
|
||||
Step(
|
||||
"create-production-image",
|
||||
byg.Step{
|
||||
Execute: func(ctx byg.Context) error {
|
||||
tempmount := fmt.Sprintf("/tmp/%s", opts.BinName)
|
||||
usrbin := fmt.Sprintf("/usr/bin/%s", opts.BinName)
|
||||
c := container.MountFileFromLoaded(scratch, bin, tempmount)
|
||||
if opts.BaseImage == "" {
|
||||
opts.BaseImage = "harbor.front.kjuulh.io/docker-proxy/library/busybox"
|
||||
}
|
||||
c := container.LoadImage(client, opts.BaseImage)
|
||||
c = c.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{"mkdir", "-p", "/usr/bin", "&&", "cp", tempmount, usrbin},
|
||||
Args: []string{"mkdir", "-p", "/tmp/bin/", "/usr/bin/"},
|
||||
})
|
||||
finalImage = c.WithEntrypoint([]string{opts.BinName})
|
||||
tempmount := fmt.Sprintf("/tmp/bin/%s", opts.BinName)
|
||||
usrbin := fmt.Sprintf("/usr/bin/%s", opts.BinName)
|
||||
c = container.MountFileFromLoaded(c, bin, tempmount)
|
||||
c = c.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{
|
||||
"ls", "/tmp/bin",
|
||||
},
|
||||
})
|
||||
finalImage = c.WithEntrypoint([]string{usrbin})
|
||||
|
||||
return nil
|
||||
},
|
||||
|
Reference in New Issue
Block a user