I porting the Elixir SDK into the Dagger repo and stuck with copying code to host after generate the api. Let's take a look at this example:
package main
import (
"context"
"os"
"dagger.io/dagger"
"github.com/wingyplus/must"
)
func main() {
client := must.Must(dagger.Connect(context.Background(), dagger.WithLogOutput(os.Stderr)))
defer client.Close()
con := client.
Container().
From("ubuntu").
WithExec([]string{"mkdir", "hello"}).
WithExec([]string{"sh", "-c", "echo 'Hello' >> hello/a.txt"})
client.Host().Directory(".").WithDirectory("hello", con.Directory("hello")).ID(context.Background())
}
I simulate it by create a new container that create directory and file inside that directory. And use client.Host().Directory(".").WithDirectory to copy from container to the host. I thought that could work because copy directory from container to container is working but container to host is not, and dagger engine return a result like it can copy. 😦