Reputation: 2331
I am trying to build an image using google cloud build for my GKE. Locally I can build images using this command:
docker build -t backend .
docker tag backend gcr.io/project-id/backend:v15.8
docker push gcr.io/project-id/backend:v15.8
And it works fine but when I am trying to use:
steps:
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/project-id/backend:v15.8", "."]
# push container image
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/project-id/backend:v15.8"]
This code is building the image but I don't know why some of the files it misses. I have several files in .gitignore.
I can build an image but it is not the same as I am building an image from command locally. When I am deploying it to my GKE one file is missing which is in .gitignore file. What do I need to do in order to achieve my goal
Upvotes: 0
Views: 333
Reputation: 5819
As mentioned by @JohnHanley on the comments, the use of .gcloudignore
is recommended in cases like this. You should ignore the .gitignore
file inside the .gcloudignore
to be able to use the required file.
So if you add this a line with .gitignore
to your .gcloudignore
it will fix the issue you are facing.
Upvotes: 1