Hello,
I am trying to replace my Dockerfile by creating a new container in a Dagger main.go file. I have looked through all of the documentation and have not found anything that helps with my specific issue.
Currently, I have a Dockerfile that has something like this:
services:
crdb:
image: crdbImage
volumes:
- "local/path:remote/path"
In my Dagger main.go file, I have something like:
ctx := context.Background()
// initialize Dagger client
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
panic(err)
}
defer client.Close()
src := client.Host().Directory(".")
//crdb
crdb := client.Container().
From("crdbImage").
WithDirectory("/src", src).
WithMountedCache("/remote/path", client.CacheVolume("/remote/path")).
WithExposedPort(12345).
AsService()
_, err = crdb.Start(ctx)
if err != nil {
panic(err)
}
When I run this, I can an error that says it can't access the remote path it's supposed to.
My question is how do I transfer the volumes from Dockerfile into the main.go file so that it will work the same?
TIA