I'm building a docker image of a nodejs server with the following dockerfile:
FROM node:10
ADD . /app
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "node", "index.js" ]
and trying to deploy it to a GKE cluster with this cloudbuild.yaml:
steps:
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/test:${SHORT_SHA}', '.']
- name: gcr.io/cloud-builders/docker
args: ["push", "gcr.io/$PROJECT_ID/test:${SHORT_SHA}"]
- name: "gcr.io/cloud-builders/gke-deploy:stable"
args:
- run
- --filename='/app/kubeconfig.yaml'
- --location='europe-west1-b'
- --cluster='test-kubernetes'
The first two steps work perfectly, but for the third it cant find a file I have called kubeconfig.yaml in the root directory of the server, how do I set the file path for the build step to find the file?
If it helps, I'm using this tutorial:
https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-gke
You should change the last six lines to look like this:
- name: "gcr.io/cloud-builders/gke-deploy:stable"
args: ['run', '--filename=kubeconfig.yaml', '--location=europe-west1-b', '--cluster=delete-me-2']
It’s more clean and it seems like this is the right way to do it.