How to Deploye Nuxt.js app on google cloud run with intellij pluging

问题描述 投票:0回答:1

我尝试部署 Nuxt 我的应用程序在谷歌上可以运行,带有 intellij 插件

Build [gcr.io/webapp-378307/differenceapp] succeeded


/home/ludow/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/bin/gcloud run deploy differenceapp --quiet --image gcr.io/webapp-378307/differenceapp --platform managed --project webapp-378307 --memory 256Mi --timeout 300 --concurrency 80 --max-instances 1000 --cpu 1 --clear-env-vars --clear-cloudsql-instances --client-name "Cloud Code for IntelliJ" --client-version 23.1.1-222 --region europe-west1 --allow-unauthenticated --clear-vpc-connector
Deploying container to Cloud Run service [differenceapp] in project [webapp-378307] region [europe-west1]
Deploying...
Setting IAM Policy.............done
Creating Revision........................................................failed
Deployment failed
ERROR: (gcloud.run.deploy) The user-provided container failed to start and listen on the port defined provided by the PORT=3000 environment variable. Logs for this revision might contain more information.

Logs URL: https://console.cloud.google.com/logs/viewer?project=webapp-378307&resource=cloud_run_revision/service_name/differenceapp/revision_name/differenceapp-00007-joq&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22differenceapp%22%0Aresource.labels.revision_name%3D%22differenceapp-00007-joq%22 
For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start

Failed to deploy to Cloud Run. Please ensure network is available, you are logged in to a valid GCP project, and try again.

我将其添加到我的 .env 文件中

PORT=3000

有人知道吗? 亲切

nuxt.js google-cloud-intellij
1个回答
0
投票

如果你有这样的错误:

ERROR: (gcloud.run.deploy) The user-provided container failed to start and listen on the port defined provided by the PORT=3000 environment variable. Logs for this revision might contain more information.

为了让它与 Nuxt.js 一起工作, 我添加 Dockerfile 并安装 docker-buildx,

这是我的 Dockerfile

# Use the official lightweight Node.js 18 image.
# https://hub.docker.com/_/node
FROM node:19-alpine

# Create and change to the app directory.
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
RUN npm install

# Bundle app source
COPY . .

# Build the app
RUN npm run build

# Expose the port
EXPOSE 3000

# Start the app
CMD [ "yarn", "dev" ]

© www.soinside.com 2019 - 2024. All rights reserved.