Hi everyone,
I'm building a docker image via python sdk, and I would like to publish the image to a private registry.
How can I handle it? I don't know if this is correctly, Im begining with dagger. I didn't find any command() function or something similar to execute the "docker login"
Thanks in advance
"""
Execute a command
"""
import sys
import anyio
import dagger
async def build():
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
# get reference to the local project
src_id = await client.host().workdir(".").id()
# create empty directory to put build outputs
outputs = client.directory()
nodeApp = (
client.container()
# pull container
.from_("node:18")
# mount cloned repository into image
.with_mounted_directory("/app", src_id)
# set working directory
.with_workdir("/app")
# run command to install dependencies
.exec(["npm", "install"])
# run command to test
.exec(["npm", "run", "test"])
)
await nodeApp.publish("my-remote-repository/dagger:latest")
if __name__ == "__main__":
anyio.run(build)