Skipping files when deploying node.js apps on Google App Engine
This short article describes how to skip some of files in a node.js project folder when uploading files on GAE.
There’s the skip_files entry in app.yaml at least for python in the Standard Environment , but for node.js in the Flexible Environment, there’s no such entry . There is/was if you look at the example , but it doesn’t work as of writing.
How do you know?
Well, the Flexible Environment is a VM which technically you can login. It’s not the purpose of this article, but you can login to an instance of GAE, and look at files in a Docker container by doing something like the following:
$ sudo docker exec -it … bash
Once you know the skip_files entry is not supported, the solution is rather simple. Fortunately, the Flexible Environment uses Docker and you can place a .dockerignore file in the project folder.
A .dockerignore file is usually generated (and deleted) when deploying, so you might need to keep the original entries and add your own entries. For example:
Some final thoughts
It took so much time until I found that the skip_files entry does not work, because searching web shows lots of examples using skip_files. The current solution will not be valid when there’s a better solution or skip_files is usable.