#Using COPY --from with the Go SDK
1 messages · Page 1 of 1 (latest)
Yes, you can definitely do that. Let me find a few pointers for you
This guide might be a useful place to start: https://docs.dagger.io/205271/replace-dockerfile
@dull kraken you can use the Container().From("address"). step to get whatever directory or file from other container. Here's an example:
package main
import (
"context"
"fmt"
"dagger.io/dagger"
)
func main() {
c, err := dagger.Connect(context.Background())
if err != nil {
panic(err)
}
defer c.Close()
ctx := context.Background()
helloDir := c.Container().From("hello-world").Directory("/")
out, err := c.Container().From("alpine").
WithDirectory("/hello", helloDir).
WithExec([]string{"/hello/hello"}).Stdout(ctx)
fmt.Println(out, err)
}