gpt4 book ai didi

git - 如何将特定的 git-lfs 文件下载到 Docker 容器中

转载 作者:行者123 更新时间:2023-12-02 18:00:39 26 4
gpt4 key购买 nike

我有一个包含几个大文件的 git repo。 Git-LFS 已启用。我想将其中一个文件引入 Docker 容器。我已经在容器中安装了 git-lfs。到目前为止,我有:

RUN git clone --no-checkout --depth 1 https://github.com/my-org/my-data-repo.git
RUN cd my-data-repo
RUN git lfs pull -I data/my-large-file.csv
该文件实际上已下载,但 Docker 构建过程失败,因为我收到以下错误:
Error updating the git index: (1/1), 90 MB | 4.8 MB/s                                                                                                                                                                                       
error: data/my-large-file.csv: cannot add to the index - missing --add option?
fatal: Unable to process path data/my-large-file.csv


Errors logged to .git/lfs/logs/20200709T142011.864584.log
Use `git lfs logs last` to view the log.
如何在不抛出异常的情况下执行此操作,从而终止 Docker 构建过程?

最佳答案

您的问题之一是:

RUN cd my-data-repo
RUN git lfs pull -I data/my-large-file.csv
不像你期望的那样工作:
  • 第一个进程启动,其中cd my-data-reop将当前目录设置为 my-data-repo ,
  • 然后这个过程结束(连同它的工作目录)
  • 然后启动第二个进程,运行 git lfs pull ...来自初始目录

  • 您可以对命令进行分组:
    RUN cd my-data-repo && git lfs pull -I data/my-large-file.csv
    或使用 WORKDIR命令(如建议的 here ):
    WORKDIR my-data-repo
    RUN git lfs pull -I data/my-large-file.csv

    关于git - 如何将特定的 git-lfs 文件下载到 Docker 容器中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62823944/

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