async def main():
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
netrc = client.set_secret("netrc", "doesn't matter")
cv = client.cache_volume("src")
clone = (
client.container()
.from_("alpine/git")
.with_mounted_cache("/src", cv, sharing=dagger.CacheSharingMode.PRIVATE)
.with_workdir("/src")
.with_mounted_secret("/root/.netrc", netrc)
.with_exec(
[
"git",
"clone",
"--recursive",
"https://github.com/TelkomIndonesia/vector-vault-unseal",
".",
],
skip_entrypoint=True,
)
.with_exec(["git", "rev-parse", "HEAD"], skip_entrypoint=True)
)
(await client
.container().from_("alpine")
.with_mounted_cache("/src", cv, sharing=dagger.CacheSharingMode.PRIVATE)
.with_exec(["cp", "-r", "/src", "/app"])
.directory("/app").docker_build()
)
if __name__ == "__main__":
anyio.run(main)