Hey team! I have been trying to replace a bash script I have with with equivlant go/dagger solution. I am having issues with the mounted directory...please see output
This is a simpified version what what I am trying to do, but I would expect to see a file names /tmp/derp/derp when I view the filesystem on the host. Any thoughts? Thanks!
└─❯ mount | grep derp
/home/derp/rootfs.ext4 on /tmp/derp type ext4 (rw,relatime)
┌─────────────── morpheus | 16-Jan-2024 13:43 [016] ────────────────
│ nats [localhost]
│
│ ~/D/derp 🐹 v1.21.5
└─❯ file /home/derp/rootfs.ext4
/home/derp/rootfs.ext4: Linux rev 1.0 ext4 filesystem data, UUID=61ddeea0-e736-4fee-b43b-9fefc698dddc (needs journal recovery) (extents) (64bit) (large files) (huge files)
│ ~/D/derp 🐹 v1.21.5
└─❯ cat main.go
───────┬─────────────────────────────────────────────────────────────────────────────────
│ File: main.go
───────┼─────────────────────────────────────────────────────────────────────────────────
1 │ package main
2 │
3 │ import (
4 │ "context"
5 │ "os"
6 │
7 │ "dagger.io/dagger"
8 │ )
9 │
10 │ func main() {
11 │ client, _ := dagger.Connect(context.Background(), dagger.WithLogOutput(os.St
│ derr))
12 │ defer client.Close()
13 │
14 │ // this is an ext4 fs mounted at /tmp/derp
15 │ rootfs := client.Host().Directory("/tmp/derp")
16 │
17 │ client.Container().
18 │ From("alpine:latest").
19 │ WithMountedDirectory("/tmp/rootfs", rootfs).
20 │ WithExec([]string{"touch", "/tmp/rootfs/derp"})
21 │ }
───────┴─────────────────────────────────────────────────────────────────────────────────