亚搏体育appGitLab-CI : How to build docker image from other repository?

标签 git docker continuous-integration gitlab

我希望将所有 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/

相关文章:

linux - 如何在 linux 和 windows 之间使用 git repo

node.js - 在 Mac 上打开 Electron 应用程序时出现问题 - "the git command requires command line developer tools."

node.js - 从 docker 容器内发布 NPM 包

windows - Golang Docker容器无法在Windows Home上启动

c# - Visual Studio Team Services - 如何将构建的 Windows 服务文件复制到 Azure VM

amazon-web-services - 如何将特定工件版本部署到 AWS ECS,而不在 Cloudformation 模板中对其 ID 进行硬编码

git - 从 git 存储库中完全删除文件及其历史记录

docker - Docker Swarm代理如何将其IP告诉Swarm Manager?

docker - 容器化和编排使用哪个工具以及原因

ios - Jenkins + Make + xcodebuild 或 Jenkins + sh + xcodebuild