I have built a Node.js app and what I do to deploy is cd
into my project's directory and run gcloud preview app deploy
. This works, but in the files I also have a JSON file which acts like the database for my application, which I do not want updated on the site when I deploy.
I cannot seem to find any way of doing this.
Any idea?
Warning: You cannot undo this operation. If you want to delete a deployment, but keep all the underlying resources, you must use the Google Cloud CLI or the API. In the console, open the Deployments page.
In the Google Cloud console, go to the Cloud Storage Browser page. In the list of buckets, click on the name of the bucket that you want to upload an object to. In the Objects tab for the bucket, either: Drag and drop the desired files from your desktop or file manager to the main pane in the console.
App Engine provides the gcloud app deploy command, which builds an image with your source code and deploys that image on App Engine. You can use the cloud-sdk image as a build step in your config file to invoke gcloud commands within the image.
There is skip_files directive in your app.yaml to exclude paths or files you do not want deployed.
But If you are working on a node.js project you would have to use .gcloudignore
file which will specify which directories to exclude.
This .gcloudignore would prevent the upload of the node_modules/ directory and any files ending in ~:
node_modules/
*~
Reference to documentation:
1. https://cloud.google.com/sdk/gcloud/reference/topic/gcloudignore
2. https://cloud.google.com/appengine/docs/standard/nodejs/config/appref (search 'skip_files')
I believe you will want to use the skip_files directive in your app.yaml to exclude paths or files you do not want deployed.
Something like:
skip_files:
- ^your_data_dir/.*\.json?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With