云 运行 容器未构建可能是由于包问题?

Cloud Run Container Not Building Possibly Due to Package Issue?

我在从 GCP 项目中的特定目录构建 Cloud 运行 容器时遇到错误。此特定目录在过去始终正确构建,自上次成功构建以来未对其进行任何更改。

不过,最近我想为这个目录启动一个管道,所以我在代码中添加了几个井号(这样 Cloud Build 触发器就可以开始构建 运行 容器 - 此外,添加这些井号不应影响代码中的任何内容)。在此过程中,出现了这个错误:

E: Unable to locate package python3.7-dev
E: Couldn't find any package by glob 'python3.7-dev'
E: Couldn't find any package by regex 'python3.7-dev'
The command '/bin/sh -c apt-get update   && apt-get upgrade -y   && apt-get install -y wget 
unzip xvfb libxtst6 libxrender1 python3.7-dev build-essential net-tools' returned a non-zero 
code: 100

鉴于没有任何改变,我不确定是什么导致了这个错误。此错误消息意味着什么,我应该采取什么措施来修复它?感谢任何帮助,如果需要更多信息,我会很乐意更新问题。谢谢!

编辑:这些是 dockerfile 内容:

FROM python:3.7-slim

# Allow statements and log messages to immediately appear in the Cloud Run logs
ENV PYTHONUNBUFFERED True

# install dependencies
RUN  apt-get update \
  && apt-get upgrade -y \
  && apt-get install -y wget unzip xvfb libxtst6 libxrender1 python3.7-dev build-essential net-tools
#RUN apt-get install -y procps

# set environment variables
ENV TWS_INSTALL_LOG=/root/Jts/tws_install.log \
    ibcIni=/root/ibc/config.ini \
    ibcPath=/opt/ibc \
    javaPath=/opt/i4j_jres \
    twsPath=/root/Jts \
    twsSettingsPath=/root/Jts

# make dirs
RUN mkdir -p /tmp && mkdir -p ${ibcPath} && mkdir -p ${twsPath}

# copy over IB Gateway
COPY Jts /root/Jts
COPY i4j_jres /home/mmr/.i4j_jres

# download IBC
RUN wget -q -O /tmp/IBC.zip https://github.com/IbcAlpha/IBC/releases/download/3.8.2/IBCLinux-3.8.2.zip
RUN unzip /tmp/IBC.zip -d ${ibcPath}
RUN chmod +x ${ibcPath}/*.sh ${ibcPath}/*/*.sh

# copy IBC/Jts configs
COPY ibc/config.ini ${ibcIni}

# copy cmd script
WORKDIR /home
COPY cmd.sh cmd.sh
RUN chmod +x cmd.sh

# set display environment variable (must be set after TWS installation)
ENV DISPLAY=:0


WORKDIR /home
COPY ib_server ./ib_server
COPY __init__.py .
COPY requirements.txt .
RUN pip install -r /home/requirements.txt

# execute cmd script to start Xvfb and gunicorn
CMD ./cmd.sh
# CMD tail -f /dev/null

当对目录进行更改并推送时会触发容器创建,这就是为什么我必须添加井号并推送以启动构建。

错误在于您尝试在容器中安装的 python3.7-dev 包(Dockerfile 的第 9 行),因为该包不再存在于容器的源代码中。它与您的更改或 Cloud Build 无关,因为自上次推送以来该包可能刚刚从源中删除。

如果您需要 python-dev 包,我建议您特别考虑安装 python3-dev,或 python3.9-dev,因为所有更改都在较小的 python 版本中应该相互向后兼容。

但是,如果您确实需要 python3.7-dev,则需要手动重新编译并安装软件包,或者在可以找到的地方添加源并安装。请记住,此 python 映像所基于的 debian 版本与此软件包不兼容,您需要手动解决,因此这不是一个直接的解决方案。