#how to mount a file from the home directory

1 messages · Page 1 of 1 (latest)

dry trellis
#

Is there a way to mount just a single file without the directory?

npmrcFile := client.Host().Directory(homedir).File(".npmrc")

I'm assuming the only way would be to copy this content to a temp file via normal Go and mount that instead?

#1 DONE 0.5s
Error: input:1: container.from.withMountedDirectory.withWorkdir.withMountedFile.withExec.withExec.directory error from sender: open /Users/me/.Trash: operation not permitted
nova bronze
#

Normally this should work (unless I misunderstand).

#

could you share the exact code & output?

dry trellis
#

Friday night. We can tackle Monday. Be glad to share more. Just emulating the tutorial but trying to build node image with angular cli. Trying to mount the hosts home npmrc file to allow building and installing private registry images. Have a great weekend

somber meteor
#

@dry trellis I'm not sure I fully understand your problem but if it's that .Directory() is copying an entire directory then you should be using the include option - I can't read Go docs to save my life but the Python link is https://dagger-io.readthedocs.io/en/sdk-python-v0.3.1/api.html#dagger.api.gen.Host.directory. You can do something like client.host().directory(path="<homedir>", include=[".npmrc"]).file(".npmrc") Which will only copy the file you want into the container from the host rather than the whole directory.