Hi,
I'm working a Dagger Module that exposes a build-all function to build and export a Go binary for multiple platforms to my local filesytem.
The module exposes a BuildBinary func that returns a *File. Then I have a caller function, BuildAll, that iterates over multiple platforms to export several platform-specific binaries:
func (m *GoDagger) BuildAll(ctx context.Context,
// dir is the directory containing the Go source code
// +required
dir *Directory,
) (bool, error) {
for _, platform := range []string{"linux/amd64", "linux/arm64"} {
file := m.BuildBinary(ctx, dir, "1.22.0", platform)
file, err := file.Sync(ctx)
if err != nil {
panic(err)
}
b, err := file.Export(ctx, fmt.Sprintf("./bin/%s/app", platform))
if err != nil {
panic(err)
}
fmt.Printf("Export: %t\n", b)
}
return true, nil
}
When I run dagger call --progress plain --debug build-all --dir . the binaries are not exported. What am I missing? Thanks in advance!
. I may have to steal the line where you are forcing compression...