{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "[![Build Status](https://travis-ci.org/wtsi-hgi/thrifty-builder.svg?branch=master)](https://travis-ci.org/wtsi-hgi/thrifty-builder)\n[![codecov](https://codecov.io/gh/wtsi-hgi/thrifty-builder/branch/master/graph/badge.svg)](https://codecov.io/gh/wtsi-hgi/thrifty-builder)\n[![PyPI version](https://badge.fury.io/py/thriftybuilder.svg)](https://badge.fury.io/py/thriftybuilder)\n\n# Thrifty Builder\n_Builds Docker images, capturing information to reduce the frequency of future re-builds_\n\n## Introduction\nThrifty builder stores a hash of all the ingredients that go into building a Docker image so the tool is able to \ndetermine if an image has already been built before, even if the build cache has been emptied or if the build is taking\nplace on a different machine with a separate cache.\n\nIn our setup, we are building a large number of Docker images in our CI. The CI job runs on a different machine each \ntime (with separate caches), meaning that if `docker build` was used, all images would be rebuild every time \nthe CI runs. Pulling first would sped things up but it would require all images to be downloaded to the build machine \nfirst! \n\nThe aim is to minimise our CI run time and to keep our Docker images as stable as possible (it is usually \nextremely difficult to version everything that goes into an image so each re-build will create a slightly different \nimage, even if the context and Dockerfile are the same). \n\n\n## Installation\nPrerequisites\n- Docker (Server API version >= 1.21)\n- Python 3.6+\n\nThe tool can be installed from PyPi:\n```bash\npip install thriftybuilder\n```\n\nBleeding edge versions can be installed directly from GitHub:\n```bash\npip install git+https://github.com/wtsi-hgi/thrifty-builder.git@master#egg=thriftybuilder\n```\n\n\n## Usage\n### Configuration\nA build configuration YAML file is required to use the tool. This file details the images that are to be built, the \nDocker registries to push the created images to (optional) and the location of the checksum storage.\n\n#### Storage\n##### stdin/stdout\n(Default if not specified) \n```yaml\nchecksum_storage:\n type: stdio\n```\n\n##### Local\n```yaml\nchecksum_storage:\n type: local\n path: /root/.thrifty/checksums\n``` \n\n##### Consul\n```yaml\nchecksum_storage:\n type: consul\n url: https://example.com:8500 # Optional: derived from Consul environment variables if not set\n token: \"{{ env['CONSUL_HTTP_TOKEN'] }}\" # Optional: derived from Consul environment variables if not set\n key: ci/image-checksums\n lock: ci/image-checksums.lock\n```\n_Note: to use Consul-backed storage, the requirements in `consul_requirements.txt` must be installed (not done so by \ndefault)._\n\n\n### CLI\n```\nusage: thrifty [-h] [-v] [--built-only] configuration-location\n\nBuilds Docker images, capturing information to reduce the frequency of future\nre-builds (v1.0.0b0)\n\npositional arguments:\n configuration-location\n location of configuration\n\noptional arguments:\n -h, --help show this help message and exit\n -v increase the level of log verbosity (add multiple\n increase further)\n --built-only only print details about newly built images on stdout\n```\n\n\n### Example\n_configuration.yml_\n```yaml\ndocker:\n images:\n - name: wtsi-hgi/image-1\n dockerfile: /images/image-1/Dockerfile\n context: /images\n - name: wtsi-hgi/image-2:version-1\n dockerfile: /images/image-2/Dockerfile\n # Context assumed to be /images/image-2 \n registries:\n - url: docker.io\n username: \"{{ env['DOCKER_IO_USERNAME'] }}\"\n password: \"{{ env['DOCKER_IO_PASSWORD'] }}\"\n \nchecksum_storage:\n type: consul\n url: \"{{ env['CONSUL_HTTP_ADDR'] }}\"\n token: \"{{ env['CONSUL_HTTP_TOKEN'] }}\"\n key: ci/image-checksums\n lock: ci/image-checksums.lock\n```\n\nCLI:\n```bash\nthrifty configuration.yml\n{\"wtsi-hgi/image-1\": \"b2db4c1ae978201407c69573ba89a9b8\", \"wtsi-hgi/image-2\": \"f9a4d7cc9f7133756b36973cc2d888de\"}\n\n```\n\n\n## Development\n### Setup\nInstall the tool's dependencies and the dependencies needed for testing:\n```bash\npip install -U -r test_requirements.txt\npip install -U -r requirements.txt\npip install -U -r consul-requirements.txt\n```\n\n### Testing\nIn the project directory, run:\n```bash\nPYTHONPATH=. python -m unittest discover -v -s thriftybuilder/tests\n```\n\nThe CI runs the tests and generates coverage with `run-tests.sh`. This script runs the tests as described above in, \naddition to testing that the tool can be installed without errors.\n\nTo run the tests entirely in docker, use `run-tests-in-docker.sh` (experimental).\n\n\n## Alternatives\n- Share a build cache between all image building machines and make sure the cache is not lost. \n- More exotic Docker image builders might store information about the build context with the built image.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wtsi-hgi/thrifty-builder", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "thriftybuilder", "package_url": "https://pypi.org/project/thriftybuilder/", "platform": "", "project_url": "https://pypi.org/project/thriftybuilder/", "project_urls": { "Homepage": "https://github.com/wtsi-hgi/thrifty-builder" }, "release_url": "https://pypi.org/project/thriftybuilder/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Builds Docker images, capturing information to reduce the frequency of future re-builds", "version": "1.1.0" }, "last_serial": 4707705, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "5774c00c56b809af4c418f24121405cc", "sha256": "b51e10a8df508a65e2263c3d88b94c6a496dc7208ae78f95bc3b70258a9ee2e2" }, "downloads": -1, "filename": "thriftybuilder-1.0.0.tar.gz", "has_sig": false, "md5_digest": "5774c00c56b809af4c418f24121405cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23550, "upload_time": "2018-01-29T16:23:23", "url": "https://files.pythonhosted.org/packages/35/b9/e8c0ca4a1095bc8ca0fb52d0890082895f2e4f531e0b5ac094d57689183a/thriftybuilder-1.0.0.tar.gz" } ], "1.0.0b0": [ { "comment_text": "", "digests": { "md5": "6367f6cbbdd55953a4e8a519dca8556b", "sha256": "80c657491183956d5aeafc03441c91126d5daa08778ff5bf37f830607fbd3ab9" }, "downloads": -1, "filename": "thriftybuilder-1.0.0b0.tar.gz", "has_sig": false, "md5_digest": "6367f6cbbdd55953a4e8a519dca8556b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19278, "upload_time": "2018-01-23T15:01:11", "url": "https://files.pythonhosted.org/packages/fb/a3/85c13f995cfb981791a0085e39974e59ed3794fe246902149bead1c3ce46/thriftybuilder-1.0.0b0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "6605f30b2920113809e0b4a3f395db3b", "sha256": "6ae04d4569a1453d9ef7d664e2b308199f98e49fc87be246e073632339164410" }, "downloads": -1, "filename": "thriftybuilder-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6605f30b2920113809e0b4a3f395db3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24218, "upload_time": "2018-03-20T14:56:25", "url": "https://files.pythonhosted.org/packages/a8/7d/d1fa78a5f3f9fcff9ca2695fcaad0ccfafd46791162fe57180317f8dc5fb/thriftybuilder-1.0.1.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "b0c94157381ed9d561d595d0b57eefc0", "sha256": "8bc118197dc90c41deef4ddc075bd44e479efff6cfdb351fabb6ca1cc3237417" }, "downloads": -1, "filename": "thriftybuilder-1.0.3.tar.gz", "has_sig": false, "md5_digest": "b0c94157381ed9d561d595d0b57eefc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24459, "upload_time": "2018-10-14T20:45:36", "url": "https://files.pythonhosted.org/packages/35/b8/7ddda3a56a291965563d1d9c68e2f5062de5a7adc85c4deea0bc25886295/thriftybuilder-1.0.3.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "d9fce2fdba035724473fa7d3a979eb55", "sha256": "ad5b80b056df4e8d2a4014b1cdc2d044774c54d2f613f6c7f558a7052c29ef86" }, "downloads": -1, "filename": "thriftybuilder-1.1.0.tar.gz", "has_sig": false, "md5_digest": "d9fce2fdba035724473fa7d3a979eb55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26355, "upload_time": "2019-01-17T11:36:27", "url": "https://files.pythonhosted.org/packages/9c/ff/3b6e261f3188911c07396b37f321c630a2f15e1aa8b85a65c57b0336d002/thriftybuilder-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d9fce2fdba035724473fa7d3a979eb55", "sha256": "ad5b80b056df4e8d2a4014b1cdc2d044774c54d2f613f6c7f558a7052c29ef86" }, "downloads": -1, "filename": "thriftybuilder-1.1.0.tar.gz", "has_sig": false, "md5_digest": "d9fce2fdba035724473fa7d3a979eb55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26355, "upload_time": "2019-01-17T11:36:27", "url": "https://files.pythonhosted.org/packages/9c/ff/3b6e261f3188911c07396b37f321c630a2f15e1aa8b85a65c57b0336d002/thriftybuilder-1.1.0.tar.gz" } ] }