I am trying to deploy my cypress tests using cloud build, however, I keep getting the following error in cloud build.
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable
I am not sure what I am doing wrong.
Here is my docker file
FROM cypress/browsers:node13.8.0-chrome81-ff75
WORKDIR /root
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "cy:run:chrome"]
and here is my cloudbuild.yaml
steps:
# Build image
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/app-trick/cypress-tests', './']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/app-trick/cypress-tests']
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- 'cypress-tests'
- '--image'
- 'gcr.io/app-trick/cypress-tests'
- '--region'
- 'us-east4'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
Here is my package.json
{
"name": "cypress_nid",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"cy:open": "npx cypress open --port $PORT",
"cy:run": "npx cypress run --port $PORT",
"cy:run:chrome": "npx cypress run --browser chrome --port $PORT",
"cy:run:firefox": "npx cypress run --browser firefox --port $PORT",
"cy:run:record": "npx cypress run --record --port $PORT"
},
"author": "",
"license": "ISC",
"devDependencies": {
"cypress": "^4.11.0",
"cypress-promise": "^1.1.0"
},
"dependencies": {
"D": "^1.0.0",
"express": "^4.17.1"
}
}
package.json
where thecy:run:chrome
script is defined? – Dustin Ingram