Hi! ๐ I get different behaviours when I chain together WithExec v chunking. When its all chained, I get the expected behaviour which is great! But when I break them up, for some reason it only executes the first chain when building the container and ignores everything else ๐คท
Is there any documentation on why this is? Ill place my example below:
// T H I S W O R K S
const chromeVersion = "116.0.5845.96-1"
chromeURL := fmt.Sprintf("http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_%s_amd64.deb", chromeVersion)
tmpChromeDebFile := "/tmp/chrome.deb"
container := client.Container(
dagger.ContainerOpts{Platform: "linux/amd64"}).
From("ruby:3.1.4-bullseye").
WithExec([]string{"apt-get", "update"}).
WithExec([]string{"apt-get", "install", "-y", "cron", "zip", "unzip", "less"}).
WithExec([]string{"wget", "-O", tmpChromeDebFile, chromeURL}).
WithExec([]string{"sh", "-c", "dpkg -i " + tmpChromeDebFile + " || apt-get install -y --fix-broken"})
// T H I S D O E S N ' T W O R K
container := client.Container(
dagger.ContainerOpts{Platform: "linux/amd64"}).
From("ruby:3.1.4-bullseye")
// Install tooling
container.
WithExec([]string{"apt-get", "update"}).
WithExec([]string{"apt-get", "install", "-y", "cron", "zip", "unzip", "less"})
// Install chrome
const chromeVersion = "116.0.5845.96-1"
chromeURL := fmt.Sprintf("http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_%s_amd64.deb", chromeVersion)
tmpChromeDebFile := "/tmp/chrome.deb"
container.
WithExec([]string{"wget", "-O", tmpChromeDebFile, chromeURL}).
WithExec([]string{"dpkg", "-i", tmpChromeDebFile, "||", "apt-get", "install", "-y", "--fix-broken"})
I was hoping to pass around the container variable between functions so that I can partition WithExec chains in to something readable.
I am attempting to replace a Dockerfile after all ๐ณ
Thank you!