0

I have a node.js website that runs locally fine with node server.js. I added a Dockerfile:

FROM node:carbon    
VOLUME ["/root"]    
# Create app directory  
WORKDIR /usr/src/app    
# Install app dependencies  
# A wildcard is used to ensure both package.json AND package-lock.json are copied   
# where available (npm@5+)  
COPY package*.json ./   
RUN npm install 
# If you are building your code for production  
# RUN npm install --only=production 
# Bundle app source 
COPY . .    
EXPOSE 8080 
CMD [ "npm", "start" ]

And if I deploy my app with gcloud app deploy I can get it accessible online via a url. I believe my project is an 'App Engine' project? If I run subsequent gcloud app deploy commands, my new code gets pushed to the online site. But I can't get github master commits trigger and publish a new build.

I tried adding a trigger so that everytime new code gets added to my public github repo master branch, it gets sent to my production URL. enter image description here

Full Trigger: enter image description here

So I merge a PR into the master branch of my github repo. I look in my build history and see there is a new build, clicking the commit takes me to the new pr I just merged into the master branch of my github repo.

enter image description here

But If I access my website url, the new code is not there. If I run cloud app deploy again eventually it will appear, my trigger seems to be working fine from the logs, why is my build not getting published?

enter image description here

Martin
  • 1,336
  • 4
  • 32
  • 69

1 Answers1

0

I think the problem might be with the fact that you're using a Dockerfile instead of Cloud Build configuration file... Unless there's something else I'm not seeing.

Look here under the fourth step, fifth bullet, for the solution. It says:

Under Build configuration, select Cloud Build configuration file.

Alexis
  • 26
  • 5
  • thx, i added a cloudbuild.yaml and removed my Dockerfile, told the trigger to use cloudbuild.yaml intead, it was building but got stopped due to a timeout error. i tried adding a timeout field to the cloudbuild.yaml file but ended up somehow creating an infinite loop where builds keep getting triggered every second. my cloudbuild.yaml looks like this: `steps: - name: "gcr.io/cloud-builders/gcloud" args: ["app", "deploy"]` – Martin Oct 03 '20 at 23:15
  • thx for the info, it helped me solve this ticket's bug but i made a new ticket for the new bug im facing: https://stackoverflow.com/questions/64190045/gcloud-nodejs-cloudbuild-yaml-stuck-in-infinite-loop – Martin Oct 04 '20 at 00:13