Hello Dagger community,
I'm struggling to find an equivalent to docker tag <image name:version> <image> with a Dagger Container. My intent is to use Container.AsTarball() and load it into the Dagger K3S module's local images, i.e. ctr -n k8s.io images import <tarball>.
This works, but it's REF is its sha256 digest. I want to set the image tag:version, similar to what the Dagger Container.Publish() does, except I dont want to push it to a registry yet.
Labels aren't working either, in my current implementation:
func (m *Kube) BuildTarball(ctx context.Context, project string, title string, version string) *dagger.File {
return dag.Container(dagger.ContainerOpts{Platform: "linux/amd64"}).
WithMountedDirectory("/app", m.Source).
WithWorkdir(fmt.Sprintf("/app/%s", project)).
Directory(fmt.Sprintf("/app/%s", project)).
DockerBuild(dagger.DirectoryDockerBuildOpts{
Platform: "linux/amd64",
Dockerfile: "Dockerfile",
}).
WithLabel("org.opencontainers.image.title", title).
WithLabel("org.opencontainers.image.version", version).
//Publish(ctx, fmt.Sprintf("%s:%s", title, version)).
AsTarball()
}
Any advice would be appreciated.
Thank you in advance.