.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
Docker build automation
=======================
Overview
--------
This package provides a script which builds multiple Docker containers in
sequence, using the contents of a ``docker_images.txt`` file in some directory.
This file is tab-delimited, and lines starting with ``#`` are ignored.
Each non-comment line in ``docker_images.txt`` is of the format::
label path/to/Dockerfile comma,separated,options,if,desired
(with arbitrary whitespace between pieces). By default, images
will be built by running ``docker build -t label -f Dockerfile .`` in the parent
directory of the Dockerfile. Add the option ``base_directory_build`` after the
Dockerfile to specify that the image should be built with::
docker build -t label -f path/to/Dockerfile .
in the directory containing ``docker_images.txt`` instead. If the default behavior
is acceptable, the third tab-delimited piece of each line can be omitted.
Docker images will be built in sequence, so images can refer to the results of
previous images, e.g.::
image-base base/Dockerfile
image-dev dev/Dockerfile
with ``dev/Dockerfile`` containing::
FROM image-base
...
Since images are unconditionally built with the ``latest`` tag, first, then
tagged with a timestamp if desired, no ``Dockerfile`` needs to be modified for
a "release" image.
The container build script checks for any uninitialized Git submodules, and
by default refuses to build if any are found. This can be overridden if
desired (see below).
The build option ``write_git_version`` accepts a file path argument, to which
the output of ``git describe --dirty --always --abbrev=12`` is written. For example::
image_label path/to/Dockerfile write_git_version=src/revision.txt
Cross-platform builds
---------------------
The build option ``platforms`` accepts a ``&``-delimited list of platforms, which
will be passed directly to ``docker build --platforms=...``, with ``&`` replaced by
``,`` in the ``docker build`` invocation. Note that this may require usage of the
newer ``buildx`` tool, replacing the legacy ``docker build``.
Usage
-----
The command-line entry point provided by this script is
``build_docker_images``. By default, images will be tagged with
``:latest`` appended to the base image name.
Options:
--tag-timestamp In addition to tagging images as ``latest``, also tag with a
timestamp in ``YYYYMMDD-HHmmss`` format. All images in
``docker_images.txt`` are tagged with the same timestamp.
Can be combined with ``--tag=tag_name``.
--tag=tag_name In addition to tagging images as ``latest``, also tag with the
tag name provided. All images in ``docker_images.txt`` are
tagged with the same tag name. Can be combined with
``--tag-timestamp``.
--push Push all built containers to Docker Hub, tagged as ``latest``
and with any additional tags specified via ``--tag-timestamp``
or ``--tag=tag_name``.
--ignore-missing-submodules Allow building Docker containers if
``git submodule`` reports that at least one submodule is
uninitialized.
--pretend Run in pretend mode: don't actually execute anything
(building, tagging, pushing).
Requirements
------------
Python 3.6 or newer for this script. Docker to build/tag/push images (version
unimportant).
Raw data
{
"_id": null,
"home_page": "https://github.com/mruffalo/multi-docker-build",
"name": "multi-docker-build",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "docker automation",
"author": "Matt Ruffalo",
"author_email": "matt.ruffalo@gmail.com",
"download_url": "",
"platform": null,
"description": ".. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n\nDocker build automation\n=======================\n\nOverview\n--------\n\nThis package provides a script which builds multiple Docker containers in\nsequence, using the contents of a ``docker_images.txt`` file in some directory.\nThis file is tab-delimited, and lines starting with ``#`` are ignored.\n\nEach non-comment line in ``docker_images.txt`` is of the format::\n\n label path/to/Dockerfile comma,separated,options,if,desired\n\n(with arbitrary whitespace between pieces). By default, images\nwill be built by running ``docker build -t label -f Dockerfile .`` in the parent\ndirectory of the Dockerfile. Add the option ``base_directory_build`` after the\nDockerfile to specify that the image should be built with::\n\n docker build -t label -f path/to/Dockerfile .\n\nin the directory containing ``docker_images.txt`` instead. If the default behavior\nis acceptable, the third tab-delimited piece of each line can be omitted.\n\nDocker images will be built in sequence, so images can refer to the results of\nprevious images, e.g.::\n\n image-base base/Dockerfile\n image-dev dev/Dockerfile\n\nwith ``dev/Dockerfile`` containing::\n\n FROM image-base\n ...\n\nSince images are unconditionally built with the ``latest`` tag, first, then\ntagged with a timestamp if desired, no ``Dockerfile`` needs to be modified for\na \"release\" image.\n\nThe container build script checks for any uninitialized Git submodules, and\nby default refuses to build if any are found. This can be overridden if\ndesired (see below).\n\nThe build option ``write_git_version`` accepts a file path argument, to which\nthe output of ``git describe --dirty --always --abbrev=12`` is written. For example::\n\n image_label path/to/Dockerfile write_git_version=src/revision.txt\n\n\nCross-platform builds\n---------------------\n\nThe build option ``platforms`` accepts a ``&``-delimited list of platforms, which\nwill be passed directly to ``docker build --platforms=...``, with ``&`` replaced by\n``,`` in the ``docker build`` invocation. Note that this may require usage of the\nnewer ``buildx`` tool, replacing the legacy ``docker build``.\n\nUsage\n-----\n\nThe command-line entry point provided by this script is\n``build_docker_images``. By default, images will be tagged with\n``:latest`` appended to the base image name.\n\nOptions:\n\n--tag-timestamp In addition to tagging images as ``latest``, also tag with a\n timestamp in ``YYYYMMDD-HHmmss`` format. All images in\n ``docker_images.txt`` are tagged with the same timestamp.\n Can be combined with ``--tag=tag_name``.\n\n--tag=tag_name In addition to tagging images as ``latest``, also tag with the\n tag name provided. All images in ``docker_images.txt`` are\n tagged with the same tag name. Can be combined with\n ``--tag-timestamp``.\n\n--push Push all built containers to Docker Hub, tagged as ``latest``\n and with any additional tags specified via ``--tag-timestamp``\n or ``--tag=tag_name``.\n\n--ignore-missing-submodules Allow building Docker containers if\n ``git submodule`` reports that at least one submodule is\n uninitialized.\n\n--pretend Run in pretend mode: don't actually execute anything\n (building, tagging, pushing).\n\nRequirements\n------------\n\nPython 3.6 or newer for this script. Docker to build/tag/push images (version\nunimportant).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Automated building/tagging/pushing of multiple Docker images in succession",
"version": "0.7.2",
"project_urls": {
"Homepage": "https://github.com/mruffalo/multi-docker-build"
},
"split_keywords": [
"docker",
"automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cb41dd3e6ca2c4d5ea0fa285f5322ca00823886aab6db066f96ec8ae42f89978",
"md5": "fa8d659ae629ebbdca30643404cdba41",
"sha256": "ef42264e3f76b2b8bfdd8a40077995622d55d6c69fa5b4030f0562f09fb7481c"
},
"downloads": -1,
"filename": "multi_docker_build-0.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa8d659ae629ebbdca30643404cdba41",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8094,
"upload_time": "2023-05-11T14:33:03",
"upload_time_iso_8601": "2023-05-11T14:33:03.366668Z",
"url": "https://files.pythonhosted.org/packages/cb/41/dd3e6ca2c4d5ea0fa285f5322ca00823886aab6db066f96ec8ae42f89978/multi_docker_build-0.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-11 14:33:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mruffalo",
"github_project": "multi-docker-build",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "multi-docker-build"
}