I'm trying to use the publish with the python sdk with this
import os
import sys
import anyio
import dagger
async def build():
with dagger.Connection(dagger.Config(log_output=sys.stdout)) as client:
dir = client.host().directory(
".", include=["src", "Cargo*", "Dockerfile"])
build = client.container().build(dir, "Dockerfile")
# image_ref = os.getenv("IMAGE_REF")
# if image_ref is not None:
# str = await build.publish(image_ref)
# return
# image_registry = os.getenv("IMAGE_REGISTRY")
# image_name = os.getenv("IMAGE_NAME")
# image_tag = os.getenv("IMAGE_TAG")
# if image_name is not None and image_registry is not None and image_tag is not None:
# await build.publish(image_ref.format(
# "%s/%s:%s", image_registry, image_name, image_tag))
# return
str = await build.publish("ghcr.io/laupse/ecowatt-twitter-bot:main")
print("Image has not been published check if this is the behavior you were looking for")
if __name__ == "__main__":
anyio.run(build)
But it ends with this error
TypeError: Cannot convert value to AST: <Directory instance>.
Full stack trace is joined