-4
FROM node:17-slim
WORKDIR /usr/src/app
COPY . .
COPY . ./
RUN npm install
RUN npm run build

CMD ["npm","start"]

 "scripts": {
    "start": "tsc && node dist/app.js",
  },

My project is TypeScript Node JS

it is so ridiculous 50% deploy success and 50% deploy failed (Okay maybe not 50% maybe 20-30%)

Cloud Run error: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

Same code, Same Cloud run enviorment on GCP console

--BTW

By the way can somebody help this DockerFile to be more robust?

I need to copy everything..

--

Why If I use IntelliJ Cloud Run deploy then some excutable file can work correctly and if I do in terminal with commands then those files are not working .. sending files in different way internally maybe?? have any idea??

dontknowhy
  • 2,480
  • 2
  • 23
  • 67
  • 1
    Please stop making duplicate of your own question, focus in only one and add as needed details in just one question instead of spreading the details in multiple question. I'm downvoting this question because this a duplicate of this question https://stackoverflow.com/questions/71633911/cloud-run-proper-deploy-commands and this question https://stackoverflow.com/questions/71618132/how-to-deploy-typescript-project-on-cloud-run – Puteri Mar 27 '22 at 17:19

1 Answers1

0

That Dockerfile has no ports at all; how about explicitly declaring EXPOSE 8080? I'd suggest to follow the hint provided: "Logs for this revision might contain more information" ...in order to see, why it even fails to bind the port.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • I actually pasted it and deleted it. Another Stack Overflow article recommends not to use EXPOSE for Cloud Run. I don\`t know why.. but sample google cloud run projects also don\`t use EXPOSE keyword.. And even when using EXPOSE, that error occurred frequently. – dontknowhy Mar 27 '22 at 12:51
  • Hi I really wrote in detail please check this https://stackoverflow.com/questions/71641915/cloud-run-deploy-with-commands-vs-deploy-with-intelij-cloud-code – dontknowhy Mar 28 '22 at 03:24