How to fix Google Cloud Build ignoring .dockerignore
Problem:
You want to run a docker image build on Google Cloud Build, but the client is trying to upload a huge context image to Google Cloud even though you have added all your large directories to your .dockerignore and the build works fine locally.
Solution
Google Cloud Build ignores .dockerignore by design - the equivalent is called .gcloudignore.
You can copy the .dockerignore behaviour for gcloud by running
copy-dockerignore-to-gcloudignore.sh
cp .dockerignore .gcloudignoreIf this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow