#What is retrieves?

1 messages ยท Page 1 of 1 (latest)

bright hare
#

Thanks Marco. So, I have a working simple build function for a container in TS.

#
  @func()
  async build(src: Directory): Promise<Container> {
      const ref = dag
        .container()
        .withDirectory("/path/to/dockerfile", src)
        .withWorkdir("path/to/dockerfile")
        .directory("path/to/dockerfile")
        .dockerBuild()
    return ref
  }

And it seems to work.

However, the different withDirs and directory methods confuse me. ๐Ÿ˜Š

If I change the paths to anything else, the build fails either with Dockerfile can't be found or a with more exotic lsat error and I'm uncertain what this works and other paths don't.

sturdy crane
#

@bright hare since you're already passing a directory in the function argument that contains a dockerfile, you only need to do src.Directory("/path/to/dockerfile").dockerBuild() and that should be it

#

no need to create a dag.Container and add a directory since you already have a reference to the directory with the underlying Dockerifle somewhere ๐Ÿ˜…

bright hare
#

๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ I knew I was doing something stupid. ๐Ÿ˜›

#

Actually, src.dockerBuild() works too.

#

So,

  @func()
  async build(src: Directory): Promise<Container> {
      const ref = src
        .dockerBuild()
    return ref
  }
#

I still feel like I'm totally missing some common thread or concept or even paradigm shift to understanding how to use Dagger properly. ๐Ÿค”

sturdy crane
#

if the Dockerfile is at some other level, you'd have to change the function call

bright hare
sturdy crane
#

as long as the dagger.json eiher in a subfolder, or part of the same git project of your code

bright hare
#

Thanks Marco. I think I'm getting it slowly but surely. ๐Ÿ™‚

sturdy crane
bright hare
#

Or, can I just continue here?

sturdy crane
bright hare
sturdy crane
sturdy crane
#

will be published soon ๐Ÿ™