# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['dockerensure']

package_data = \
{'': ['*']}

setup_kwargs = {
    'name': 'dockerensure',
    'version': '0.0.3',
    'description': 'Ensure that Docker images are ready for use',
    'long_description': '# Docker Ensure\n\nDocker Ensure is a tool that ensures Docker images are available on your system by building or downloading the image if necessary.\n\n## Installing Docker Ensure\n\n```\npip install dockerensure\n```\n\n## Basic Usage\n\nSay we have a Dockerfile `first.Dockerfile` that we build into `first-image`. The following code will ensure that an image called `first-image` exists by building it if it doesn\'t yet exist.\n\nThe `BuildConfig` will not make any files available to the build context by using a wildcard `.dockerignore` file.\n\n```\nDockerImage(\n    "first-image",\n    build_config=BuildConfig(\n        "first.Dockerfile",\n        files=FilePolicy.Nothing\n    )\n).ensure()\n```\n\nThe simple declaration above will only rebuild if `first-image` doesn\'t exist on the system. If we have an image registry we can include that as a place to search for images:\n\n```\nregistry = DockerRegistry("my.registry")\nDockerImage(\n    "first-image",\n    build_config=BuildConfig(\n        "first.Dockerfile",\n        files=FilePolicy.Nothing\n    ),\n    registry=registry\n).ensure()\n```\n\nDockerEnsure will check the registry for the image before building. If the image doesn\'t exist the build will take place and the image will be pushed to the registry.\nYou can control how the registry is used with the `remote_policy` argument.\n\nIn the above examples if the Dockerfile is changed the image won\'t be rebuild as long as it exists. We can include a hash in the image tag consisting of the state of the build config to detect any changes to that config:\n\n```\nimage = DockerImage(\n    "first-image",\n    with_hash=True,\n    build_config=BuildConfig(\n        "first.Dockerfile",\n        files=FilePolicy.Nothing\n    )\n)\nprint(image.ref)  # e.g. first-image:abcd9876\n```\n\nIf the contents of `first.Dockerfile` change the hash will also change and a new image will be built. In these situations the full reference of the image is not known in advance and you must use `.ref` to return the name and tag so you can use the image elsewhere.\n\n### Other build config parameters\n\nThe build config object contains all inputs to your build. You can pass a number of different parameters to this object:\n- dockerfile: The dockerfile to build with\n- build_args: Docker build args that will be passed to the build.\n- parents: List of DockerImages that this image depends on. These images will be ensured before this image is built.\n- files: A FilePolicy object describing what files are to be made available to the build\n- metadata: Additional metadata to include in the hash. This won\'t be passed to the Docker build\n- interval: An interval to refresh the hash after. \n- directory: Directory to set the build context to. Leave as None for the current directory\n- unhashed_build_args: Docker build_args that won\'t be included in the hash. These could include credentials and other data that is required by the build but won\'t affect the built image.\n\n#### File Policy\n\nYou can control what files are available to the build context by using a `FilePolicy`. `FilePolicy.All` is the default and makes all files available. `FilePolicy.Nothing` is the opposite - all files will be excluded. If you ran `COPY . .` in your Dockerfile, nothing would be copied.\n\n`FilePolicy.Only` specifies certain files to include - everything else is excluded. This is used when you know exactly which files your build needs. For example, if you\'re running `pip install -r requirements.txt` in your Dockerfile your file policy would be `FilePolicy.Only(["requirements.txt"])`.\n\n`FilePolicy.AllBut` excludes certain files. Maybe you\'re building from a Git repo - in that case use `FilePolicy.AllBut([".git/"])`.\n\nIf you are including the hash of the build state in your image name you are limited to using `Nothing` or `Only` file policies. This is because all the files included in the file policy are used to calculate the hash. Furthermore when using `Only` you must use files, not directories.\n\n#### Metadata\n\nYou can include extra string metadata that will affect the hash but not be included in the build. This is completely arbitrary and user defined.\n\n#### Interval\n\nTo prevent builds becoming outdated you can use the interval parameter to force a rebuild after a period of time. Rhis is recommended if your Dockerfile installs from a repository (e.g. `apt get update && apt get upgrade`).\n\n`IntervalOffset(timedelta(days=1))` will change the hash every day.\n\nNote that you must be using `with_hash=True` on the DockerImage for this to have any effect.\n\n#### Unhashed build args\n\nYou may want to pass build args to the build without affecting the build state hash. For example, temporary credentials that are discarded after use. In this case we need the build to have these credentials but we don\'t want the hash to change every time the credentials are rotated.\n\n`BuildConfig(..., unhashed_build_args={"REPO_TOKEN": "abcxyz"})`\n\n## Versioning Images\n\n\n\n## Images without BuildConfig\n\n',
    'author': 'ubuntom',
    'author_email': None,
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/ubuntom/dockerensure',
    'packages': packages,
    'package_data': package_data,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
