google-cloud-platform - 在 Google Cloud Run 中容器化应用程序时出现 Docker 错误
问题描述
我正在尝试从Google Cloud Run 中的拥抱脸运行变形金刚。
我的第一个想法是运行一个由 huggingface 提供的 dockerfile,但这似乎是不可能的。
有关如何解决此错误的任何想法?
Step 6/9 : WORKDIR /workspace
---> Running in xxx
Removing intermediate container xxx
---> xxx
Step 7/9 : COPY . transformers/
---> xxx
Step 8/9 : RUN cd transformers/ && python3 -m pip install --no-cache-dir .
---> Running in xxx
←[91mERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
The command '/bin/sh -c cd transformers/ && python3 -m pip install --no-cache-dir .' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
←[0m
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build xxx completed with status "FAILURE"
来自拥抱脸的Dockerfile:
FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04
LABEL maintainer="Hugging Face"
LABEL repository="transformers"
RUN apt update && \
apt install -y bash \
build-essential \
git \
curl \
ca-certificates \
python3 \
python3-pip && \
rm -rf /var/lib/apt/lists
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir \
mkl \
tensorflow
WORKDIR /workspace
COPY . transformers/
RUN cd transformers/ && \
python3 -m pip install --no-cache-dir .
CMD ["/bin/bash"]
来自 Google Cloud Run文档的 .dockerignore 文件:
Dockerfile
README.md
*.pyc
*.pyo
*.pyd
__pycache__
.pytest_cache
- - 编辑:
根据达斯汀的回答设法开始工作。我基本上:
- 将 Dockerfile 与 transformers 文件夹一起保留在根文件夹中。
- 将 dockerfile 中的 COPY 行更新为:
COPY . ./
解决方案
错误是:
Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
这是由于您的以下两行Dockerfile
:
COPY . transformers/
RUN cd transformers/ && \
python3 -m pip install --no-cache-dir .
这会尝试将包含 的本地目录复制Dockerfile
到容器中,然后将其安装为 Python 项目。
看起来期望在https://github.com/huggingface/transformersDockerfile
的存储库根目录中运行。您应该克隆存储库并将要构建的内容移到根目录中,然后再次构建。Dockerfile
推荐阅读
- laravel - Laravel 中的多条件搜索功能
- ruby-on-rails - 将数据发送到 ruby on rails 中的 url
- pip - 尝试安装 arviz 时,我收到以下错误消息:“错误:python setup.py egg_info”失败,错误代码为 1
- python - 在heroku上部署我的django-rest项目的问题
- c - 为什么我的信号量锁没有按预期锁定这个进程?(多线程)
- javascript - 使用反向通道从我的网站中的网络聊天通话中获取价值
- excel - 形状(工作表)与控件(用户窗体)
- css - 材质图标未在 Hyperhtml 中加载
- amazon-web-services - aws sts get-session-token 因配置文件失败
- azure - Microsoft Azure - 防止创建 MSDN 信用额度未涵盖的资源的策略