gpt4 book ai didi

docker - 如何在 docker build 中安装具有私有(private)子模块的私有(private)存储库?

转载 作者:行者123 更新时间:2023-12-02 19:28:37 26 4
gpt4 key购买 nike

我正在构建一个需要对私有(private) python 存储库的一些依赖项的项目。这个仓库有一个子模块,它也指向一个私有(private)仓库。我可以使用在容器内不方便的 ssh key 在我的机器上获取它。
在我的 dockerfile 中,我阻止了这一步:

RUN pip3 install wheel \
&& pip3 wheel git+https://${GITHUB_TOKEN}@github.com/owner/repo.git@master \
--wheel-dir=/svc/wheels
它可以毫无问题地获取 repo,但无法处理子模块。我猜 pip 解析了 URL 并且没有传递最初传输的 token 。
我真的不知道如何解决这个问题。我可以在本地拥有该文件夹并复制它,或者设置一个我在构建期间访问的私有(private) pip 存储库(如果可能的话),或者在容器内使用 ssh key (对我来说听起来很糟糕)。
有没有“标准的方法”?如果不是,你会建议什么?
EDIT1:这似乎是一个 git 问题,如 git clone --recursive也不行

最佳答案

而不是通过${GITHUB_TOKEN)在命令行上,您应该能够将其配置为 .netrc如描述的文件,例如in this answer .

您的 Dockerfile将包括以下内容:

RUN echo machine github.com login ${GITHUB_TOKEN} > ~/.netrc
RUN pip3 install wheel \
&& pip3 wheel git+https://github.com/owner/repo.git@master \
--wheel-dir=/svc/wheels

关于docker - 如何在 docker build 中安装具有私有(private)子模块的私有(private)存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53781546/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com