如何解决在Google Cloud Run中对应用程序进行容器化时的Docker错误
我正在尝试从transformers在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"
来自huggingface的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"]
.dockerignore来自Google Cloud Run documentation的文件:
Dockerfile
README.md
*.pyc
*.pyo
*.pyd
__pycache__
.pytest_cache
----编辑:
根据达斯汀的答案设法开始工作。我基本上是:
- 将Dockerfile和转换器文件夹一起留在根文件夹中。
- 将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项目。
看起来Dockerfile
有望在https://github.com/huggingface/transformers的存储库根目录下运行。您应该克隆存储库,并将要构建的Dockerfile
移至根目录,然后再次构建。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。