While porting our application build scripts, I ran into an issue where the Dagger process would get stuck while exporting the node_modules folder back to the host filesystem (the folder contains around 150.000+ files).
While troubleshooting the larger job, I created the most simple scenario which describes what I’m trying to do: install aws-cli, download tarball from s3, extract it, and copy it to the host FS. This still got stuck on exporting the job.
I simplified the job further, by skipping the whole s3 part and using the client.host().directory) method to provide the node_modules.tar.gz testfile. That worked! The export was done within a short time.
I’ve now added fallocate -l 536870912 ./dagger_workaround/512MB.zip to the script that executes dagger, and with this hack I’m able to bypass the issue I’m experiencing
async def main():
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
out = await (
client.container()
.from_("alpine:latest")
.with_directory("/host", client.host().directory("./dagger_workaround/"))
.with_env_variable("AWS_ACCESS_KEY_ID", os.environ["AWS_ACCESS_KEY_ID"])
.with_env_variable("AWS_SECRET_ACCESS_KEY", os.environ["AWS_SECRET_ACCESS_KEY"])
.with_env_variable("AWS_SESSION_TOKEN", os.environ["AWS_SESSION_TOKEN"])
.with_env_variable("AWS_DEFAULT_REGION", "eu-west-1")
.with_exec(["apk", "add", "--update", "--no-cache", "aws-cli"])
.with_exec(["aws", "s3", "cp", f"s3://location-of-my-bucket/node_modules.tar.gz", "/node_modules.tar.gz", "--only-show-errors"])
.with_exec(["tar", "-zxf", "/node_modules.tar.gz"])
.directory("/node_modules")
.export("./node_modules_out")
)
print(out)