#How to pass context to the build method

1 messages · Page 1 of 1 (latest)

rugged portal
#

How do you pass a context to the build method? I can find no example of how this should be done with the NodeJS SDK, and build appears to be the only container method that requires the context 🤷‍♂️

weary idol
#

so you can do something like this

  // get reference to the local project
  const source = await client.host().directory(".", ["node_modules/"]).id();


  // build Dockerfile
  const build = await client
    .container().build(source.id).exitCode()

  console.log(build)
#

that will basically look for a Dockerfile in the directory where you're running your script and build it

turbid ruin
#

Hi @rugged portal 👋 ! Did you manage to sort this out ? Thanks