连续自动生成/标记/推送多个Docker图像
multi-docker-build的Python项目详细描述
概述
这个包提供了一个脚本,在其中构建多个Docker容器 序列,使用某个目录中docker_images.txt文件的内容。 此文件用制表符分隔,以#开头的行被忽略。在
docker_images.txt中的每个非注释行的格式如下:
label path/to/Dockerfile comma,separated,options,if,desired
(任意空格)。默认情况下,图像 将通过在父级中运行docker build -t label -f Dockerfile .生成 Dockerfile的目录。将选项base_directory_build添加到 Dockerfile指定映像应使用以下内容生成:
^{pr2}$在包含docker_images.txt的目录中。如果默认行为 可以接受,可以省略每行的第三个制表符分隔的部分。在
Docker图像将按顺序构建,因此图像可以引用结果 以前的图像,例如:
image-base base/Dockerfile image-dev dev/Dockerfile
其中dev/Dockerfile包含:
FROM image-base ...
因为图像是用latest标记无条件地构建的,所以首先,然后 如果需要,用时间戳标记,不需要修改Dockerfile “发布”图像。在
容器构建脚本检查任何未初始化的Git子模块,以及 默认情况下,如果找到任何文件,则拒绝生成。如果出现以下情况,则可以重写此选项 期望(见下文)。在
生成选项write_git_version接受一个文件路径参数,该参数指向 写入git describe --dirty--always--abbrev=12的输出。例如:
image_label path/to/Dockerfile write_git_version=src/revision.txt
使用
此脚本提供的命令行入口点是 build_docker_images。默认情况下,图像将被标记为 :latest附加到基本映像名。在
选项:
--tag-timestamp | |
In addition to tagging images as ^{tt8}$, also tag with a timestamp in ^{tt15}$ format. All images in ^{tt1}$ are tagged with the same timestamp. Can be combined with ^{tt17}$. | |
--tag=tag_name | In addition to tagging images as ^{tt8}$, also tag with the tag name provided. All images in ^{tt1}$ are tagged with the same tag name. Can be combined with ^{tt20}$. |
--push | Push all built containers to Docker Hub, tagged as ^{tt8}$ and with any additional tags specified via ^{tt20}$ or ^{tt17}$. |
--ignore-missing-submodules | |
Allow building Docker containers if ^{tt24}$ reports that at least one submodule is uninitialized. | |
--pretend | Run in pretend mode: don’t actually execute anything (building, tagging, pushing). |
要求
或者更新的Python脚本。Docker构建/标记/推送图像(版本 不重要)。在
- 项目
标签: