[GCP] [App Engine] Streamlit Web应用程序部署-容器崩溃

时间:2020-07-10 18:57:28

标签: google-app-engine google-cloud-platform deployment streamlit

我正在尝试在Google App Engine上部署使用Streamlit开发的Web应用程序。部署过程接近完成时。我收到以下错误:

ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED

  You can now view your Streamlit app in your browser.

  Network URL: http://172.17.0.6:8080
  External URL: http://34.67.15.189:8080

Killed

我无法理解此错误的根本原因。任何建议和/或帮助将不胜感激。

编辑:

我正在使用灵活的环境。 app.yaml如下:

runtime: custom
env: flex

runtime_config:
  python_version: 3

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 5
  disk_size_gb: 25

Dockerfile如下:

FROM python:3.7

# Copy local code to the container image.
WORKDIR /app
COPY requirements.txt ./requirements.txt

# Install dependencies.
RUN pip3 install -r requirements.txt

EXPOSE 8080

COPY . /app

# Run the web service on container startup.
CMD streamlit run --server.port 8080 --server.enableCORS false app.py

而且,要求是:

pandas==0.24.2
scikit_learn==0.23.1
streamlit==0.62.1

1 个答案:

答案 0 :(得分:0)

我使用了streamlit example app和您的配置文件,我注意到您正在定义runtime_config,这是没有必要的,因为您在Dockerfile中选择了通用python docker映像,这仅适用于App Engine的Python图片。

有关自定义运行时的更多信息,请检查此document

在对文件进行了一些修改之后,所有内容都通过示例应用程序运行,请随时使用这些文件作为起始点。

这是我的文件夹结构

./
├── app.py
├── app.yaml
├── Dockerfile
└── requirements.txt

这是我的app.yaml

runtime: custom
env: flex

manual_scaling:
  instances: 1

resources:
  cpu: 4
  memory_gb: 5
  disk_size_gb: 25

这是我的Dockerfile

FROM python:3.7

# Copy local code to the container image.
WORKDIR /app
COPY requirements.txt ./requirements.txt

# Install dependencies.
RUN pip3 install -r requirements.txt

EXPOSE 8080

COPY . /app

# Run the web service on container startup.
CMD streamlit run --server.port 8080 --server.enableCORS false /app/app.py