我希望将所有 dockerfile 放在一个存储库中,而不是将它们放在单独的项目中。因此我创建了“指挥”项目。 我的所有 .gitlab-ci 阶段也在“conductor”中指定。 实际项目中我只使用了include命令。
我当前的代码:
docker build -f dockerfile .
问题是“dockerfile”不在执行管道的项目中,而是在“conductor”项目中。
如何修改 -f 参数以从另一个 gitlab 项目获取 dockerfile?
最佳答案
你可以使用
git clone https://gitlab.example.com/tanuki/awesome_project.git
克隆远程存储库。如果该存储库不可公开访问,您可以创建 deploy token为此,请使用 git clone 和部署 token 。
git clone https://<username>:<deploy_token>@gitlab.example.com/tanuki/awesome_project.git
参见:https://docs.gitlab.com/ce/user/project/deploy_tokens/#git-clone-a-repository
关于亚搏体育appGitLab-CI : How to build docker image from other repository?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65379552/