#How can I create a new File in my
1 messages · Page 1 of 1 (latest)
Concrete example I have this right now:
openapi_file = (
dag.devcontainer()
.build()
.with_mounted_directory("./code", python_src)
.with_workdir("./code")
.with_exec(
["uv run ./src/package/cli/dev.py openapi ./build/openapi.json"],
use_entrypoint=True,
)
)
which will create the openapi spec in the build folder, I want to add a .gitignore file to that build folder with the contents "*", and then return the whole build folder from the function
👋 @scenic shore you can use with_new_file to make the file at the given path: https://dagger-io.readthedocs.io/en/sdk-python-v0.18.6/client.html#dagger.Container.with_new_file
If you need to export the directory, here is an example you can follow: https://docs.dagger.io/cookbook?sdk=python#export-a-directory-or-file-to-the-host