Python 使用docker和cloud run部署dbt的正确方法
我正在尝试使用docker容器在Google云运行服务上部署dbt。但是,在尝试将构建的映像部署到云运行时,请执行以下操作。我有个错误Python 使用docker和cloud run部署dbt的正确方法,python,docker,google-cloud-run,dbt,Python,Docker,Google Cloud Run,Dbt,我正在尝试使用docker容器在Google云运行服务上部署dbt。但是,在尝试将构建的映像部署到云运行时,请执行以下操作。我有个错误 ERROR: (gcloud.run.deploy) Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision mi
ERROR: (gcloud.run.deploy) Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
这是我的文件
FROM python:3.8.1-slim-buster
RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y --no-install-recommends git software-properties-common make build-essential ca-certificates libpq-dev && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY requirements/requirements.0.17.0rc4.txt ./requirements.0.17.0rc4.txt
RUN pip install --upgrade pip setuptools
RUN pip install -U pip
RUN pip install dbt==0.17.0
RUN pip install --requirement ./requirements.0.17.0rc4.txt
RUN useradd -mU dbt_user
ENV PYTHONIOENCODING=utf-8
ENV LANG C.UTF-8
ENV PORT = 8080
ENV HOST = 0.0.0.0
WORKDIR /usr/app
VOLUME /usr/app
USER dbt_user
CMD ['dbt', 'run']
我知道运行状况检查失败是因为它找不到要侦听的端口,除非我在我的ENV
有人能帮我解决吗?thx提前根据在云上部署应用程序的要求之一,运行时监听0.0.0
上的请求并公开端口:
容器必须在发送请求的端口上侦听0.0.0.0上的请求。默认情况下,请求被发送到8080,但您可以配置Cloud Run将请求发送到您选择的端口
dbt
是一个应用程序,这意味着它不公开任何端口,因此,当您尝试部署云运行时,它会验证构建是否在侦听时失败,并出现上述错误。我认为(我不熟悉)dbt是一个命令行应用程序。从大卫·瓦斯奎兹的回购协议来看,似乎是这样的。云运行仅适用于公开HTTP接口的应用,然后是可配置为在端口${port}
上运行的应用。因此,我认为您尝试使用Cloud RunUsingdbt run
不会启动应用程序来侦听${PORT}
,因此@DazWilkin提到,您将无法使用Cloud run。