I am in the process of migrating from version 1 of Google Cloud Functions to generation 2 in cloud run. I've update my functions, but when they are deployed using --only functions:myFunction command with firebase tools it is deploying all my other functions in the file and other files with functions. I get the need for the package.json file, etc, but is there a way to deploy only the function code with the package.json, etc. files. I know there is a .gcloudignore, but to have to list and unlist files each time I need to push another function would be a real pain in the keyster. Not to mention you'll still end up with all the other functions in the file.
1 Answer
All files in your functions directory are deployed to each container, but only the identified function(s) are wired up. So in your scenario, all the code ends up in the new contains but only the myFunction function will be triggered/callable.
There is (as far as I know) no way to deploy just some of the files, but that also should make no significant difference (see What is the XY problem?)
If you want to have different sets of files being deployed to different containers, consider setting up a separate directory for each (running firebase init in each). That way you completely control what gets deployed for each directory.
2 Comments
codebase property might be useful here too btw: firebase.google.com/docs/functions/…