{ "info": { "author": "Tatsunori Saito", "author_email": "bbrfkr@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "# D4: Dock to Develop Dynamic Dockerfile\n\n## abstract\nD4 is the tool to develop generic Dockerfile. D4 will provide the easier method to build container image from Dockerfile and test the Dockerfile. By this method, you can realize TDD(Test Driven Development) of Dockerfile easily.\n\n## requirements\nD4 requires the following software.\n\n* [docker](https://www.docker.com/)\n* [container-structure-test](https://github.com/GoogleContainerTools/container-structure-test)\n* python 3.4+\n* python packages\n * docker\n * pyyaml\n\n## install\n\n```\n$ pip install d4\n```\n\n## quick start\n1. Create project `httpd`\n\n ```\n $ d4 init httpd\n $ cd httpd\n ```\n\n2. Describe image name and registry server in `common.yaml`\n\n ```\n image_name: /httpd:latest\n registry_server: docker.io\n ```\n\n3. Describe test code in `tests/config.yaml`\n\n ```\n schemaVersion: '2.0.0'\n commandTests:\n - name: \"check httpd pkg\"\n command: \"rpm\"\n args:\n - \"-qa\"\n expectedOutput:\n - \"httpd-.*\"\n metadataTest:\n exposedPorts:\n - \"80\"\n cmd:\n - \"httpd\"\n - \"-DFOREGROUND\"\n ```\n\n4. Describe mock in `Dockerfile`\n\n ```\n FROM docker.io/centos:latest\n ```\n\n5. Run develop subcommand and confirm test fails\n\n ```\n $ d4 develop\n ```\n\n6. Describe implementation in `Dockerfile`\n\n ```\n FROM docker.io/centos:latest\n RUN yum install -y httpd\n EXPOSE 80\n CMD [\"httpd\", \"-DFOREGROUND\"]\n ```\n\n7. Run develop subcommand and confirm test succeeds\n\n ```\n $ d4 develop\n ```\n\n8. Release image to your repository of dockerhub\n\n ```\n $ d4 release -u -p \n ```\n\n## usage\n### project directory architecture\nd4 project need to have the following directory architecture;\n\n```\n(project name)\n|-- Dockerfile\n|-- build.yaml\n|-- common.yaml\n`-- tests\n |-- config_1.yaml\n |-- ...\n `-- config_N.yaml\n```\n\n* Dockerfile \nThe Dockerfile which belongs to the project. For this Dockerfile, container image will be built and test will be executed. \n\n* build.yaml \nThe yaml file which has arguments to be used by building image. All arguments of the Dockerfile should be described in this file. for example;\n\n ```\n args:\n ARG_1: \"VALUE_1\"\n ARG_2: \"VALUE_2\"\n ARG_3: \"VALUE_3\"\n ```\n\n* common.yaml \nThe yaml file which has parameters to be used by both building image and testing image. for example;\n\n ```\n image_name: bbrfkr0129/httpd:latest\n registry_server: docker.io\n ```\n\n* tests/\\ \nThe yaml files which has tests to be used by testing image. These tests in the yaml files need to be written as container-structure-test can be processed.\n\n### TDD method with D4\n1. Create project with subcommand `init`. By this subcommand, basis directory architecture and sample files are created.\n\n ```\n $ d4 init tdd_project\n $ cd tdd_project\n $ tree . --charset=C\n .\n |-- Dockerfile\n |-- build.yaml\n |-- common.yaml\n `-- tests\n `-- config.yaml\n ```\n\n2. Specify developed image name and registry server pushed developed image in `common.yaml`;\n\n ```\n $ cat < common.yaml\n image_name: /tdd_image:latest\n registry_server: docker.io\n EOF\n ```\n\n3. Write mock in `Dockerfile` and `build.yaml`. Implementation is not done yet.\n\n ```\n $ cat < Dockerfile\n FROM :\n EOF\n $ cat < build.yaml\n args:\n EOF\n ```\n\n4. Write test code according to the syntax of container-structure-test in `tests/config.yaml`. In TDD, test code is written before writing `Dockerfile`.\n\n5. Execute test with subcommand `develop`. By this subcommand, mock container image is built and tested. Then tests should be failed.\n\n ```\n $ d4 develop\n ```\n\n6. Write implementation of `Dockerfile` and `build.yaml`. In `build.yaml`, The arguments in `ARG` statements of `Dockerfile`should be written;\n\n ```\n args:\n ARG_1: \"VALUE_1\"\n ARG_2: \"VALUE_2\"\n ARG_3: \"VALUE_3\"\n ```\n\n7. Execute build and test with subcommand `develop`. By this subcommand, implementation of `Dockerfile` is applied, and then generated container image is tested. All tests should be passed.\n\n ```\n $ d4 develop\n ```\n\n8. Repeat procedures 4.-7.. until required container image is got.\n\n9. Release got container image to registry server with subcommand `release`. By this subcommand, final build and test will be processed, then pushed to registry server specified in `common.yaml`.\n\n ```\n $ d4 release\n ```\n\n10. Run container from pushed container image!\n\n ```\n $ docker run /tdd_image:latest\n ```\n\n### valid subcommands\n* d4 init \nCreate and initialize project.\n\n* d4 build \nOnly build process runs.\n\n* d4 test \nOnly test process runs.\n\n* d4 login \nOnly login into registry server specified in `common.yaml`.\n\n* d4 push \nOnly push container image specified in `common.yaml`.\n\n* d4 develop \nbuild and test processes run.\n\n* d4 release \nbuild, test, login and push processes run.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pypa/d4", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "d4", "package_url": "https://pypi.org/project/d4/", "platform": "", "project_url": "https://pypi.org/project/d4/", "project_urls": { "Homepage": "https://github.com/pypa/d4" }, "release_url": "https://pypi.org/project/d4/0.1.10/", "requires_dist": null, "requires_python": "", "summary": "Dock to Develop Dynamic Dockerfile", "version": "0.1.10" }, "last_serial": 3980108, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "578b20d113cbb8d910c7dab3a3efa830", "sha256": "e153c14a9441470bfc9a03e8ddcfa929f98a2dab4f604783830c9827ca756d0f" }, "downloads": -1, "filename": "d4-0.1.0.tar.gz", "has_sig": false, "md5_digest": "578b20d113cbb8d910c7dab3a3efa830", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4421, "upload_time": "2018-06-17T12:35:20", "url": "https://files.pythonhosted.org/packages/7f/0d/bf77578cbbdfbd446e2e8ea37f92e7cf8936c0db8edc5cc824af6c10eaf3/d4-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2aea153d80954b7f0678617fd35bdca3", "sha256": "ecc84e4b2d8dcc0d4385932a2176a52810e7f6d3e7448448653bce66a0004b07" }, "downloads": -1, "filename": "d4-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2aea153d80954b7f0678617fd35bdca3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4425, "upload_time": "2018-06-17T12:42:21", "url": "https://files.pythonhosted.org/packages/16/e0/1dcc795a1b119aabd90f471e58c44d2541c4d78c0719ac4ecbf2250348aa/d4-0.1.1.tar.gz" } ], "0.1.10": [ { "comment_text": "", "digests": { "md5": "30d0989514717566e33220469613391d", "sha256": "2c899bcab60a763915a17765e970956456a34d374e926fbddb4a65ce42965762" }, "downloads": -1, "filename": "d4-0.1.10.tar.gz", "has_sig": false, "md5_digest": "30d0989514717566e33220469613391d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10543, "upload_time": "2018-06-20T05:03:25", "url": "https://files.pythonhosted.org/packages/4d/38/9cbad70c1ccfa0156b514dcd03f0b5df9263ff1face3d1902e1558e7ee74/d4-0.1.10.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c442341743dbbf947fe383370acf02d7", "sha256": "efd430603c50396ae2acf9cdd09edae7045e5b4da76e42b17d12d2bb66ebd0a3" }, "downloads": -1, "filename": "d4-0.1.2.tar.gz", "has_sig": false, "md5_digest": "c442341743dbbf947fe383370acf02d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4426, "upload_time": "2018-06-17T12:43:24", "url": "https://files.pythonhosted.org/packages/1a/fb/41044522911843567168495ef782c3f45f3c89e5a9d7096a79d8281dccb4/d4-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "305d25f96b8c783286ca92e4b38c563d", "sha256": "946c561232605b83effdfc75eefd05cd39d564d1ac730e9927601e50796191c1" }, "downloads": -1, "filename": "d4-0.1.3.tar.gz", "has_sig": false, "md5_digest": "305d25f96b8c783286ca92e4b38c563d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7535, "upload_time": "2018-06-17T12:58:43", "url": "https://files.pythonhosted.org/packages/ab/5a/c66659b0e6d2204a74109620703719e446be7c559e35d51ca29aa9592d95/d4-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "733b45b1d731d2632459ac9bb0622470", "sha256": "44c8f62a7a9e91202213b5e56c26bc96c38d819185e91def8328c488943d736b" }, "downloads": -1, "filename": "d4-0.1.4.tar.gz", "has_sig": false, "md5_digest": "733b45b1d731d2632459ac9bb0622470", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7475, "upload_time": "2018-06-17T13:10:44", "url": "https://files.pythonhosted.org/packages/d9/4f/c68b470a6592bb84c3014ed6445ea4aa6070c20da0908b45bdd57e3ea105/d4-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "2c9806d402b14a25d655574e2755bb4d", "sha256": "1929e4ae70d97593c8682c6b47c1a8b1d867be479e9847e9e9c58d6de4ee2d32" }, "downloads": -1, "filename": "d4-0.1.5.tar.gz", "has_sig": false, "md5_digest": "2c9806d402b14a25d655574e2755bb4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7476, "upload_time": "2018-06-17T13:33:35", "url": "https://files.pythonhosted.org/packages/91/88/98b606fbe947926c63f4df0490b7099ebc7491f6234d672861d8aedc0995/d4-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "6351615c44058e0f6a5e7e582a83f210", "sha256": "6d5f5c03f167a4b3e3efbdab8b018856c33a8c588005f3044a57579cf3500c84" }, "downloads": -1, "filename": "d4-0.1.6.tar.gz", "has_sig": false, "md5_digest": "6351615c44058e0f6a5e7e582a83f210", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10076, "upload_time": "2018-06-18T04:46:52", "url": "https://files.pythonhosted.org/packages/67/87/59ee434394cda5faa79f153039ee59efeb4b632877d926b0890d1f3cc690/d4-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "7172e77d80970aa581f575c0ad3593dc", "sha256": "8a6bbabe67a03c60f908715781462aa2e6dd0a4d6924e7a1c03e29a489feb48f" }, "downloads": -1, "filename": "d4-0.1.7.tar.gz", "has_sig": false, "md5_digest": "7172e77d80970aa581f575c0ad3593dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10085, "upload_time": "2018-06-18T05:11:23", "url": "https://files.pythonhosted.org/packages/9b/6c/b257d2116756e1864dc156f336b1c4ba8992154f53c1bb16b6833eb9c0ab/d4-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "949ea749524096d70a81c075488058b7", "sha256": "a52b5efdf00a54fffe0925b537b62d4d0f4252ad7252358acde75bd8e5bf2da5" }, "downloads": -1, "filename": "d4-0.1.8.tar.gz", "has_sig": false, "md5_digest": "949ea749524096d70a81c075488058b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10500, "upload_time": "2018-06-20T04:28:26", "url": "https://files.pythonhosted.org/packages/9d/25/f98875abae3694d9ffc2149b321aa159395ceb2555430411a83502b4da46/d4-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "f2f7ccd4ca2ff27dcaaa62bf0d2f4ef8", "sha256": "f94ccf4132579f1f6d3471e15ae9da58b8de4927988680b809e425c32e1bce7e" }, "downloads": -1, "filename": "d4-0.1.9.tar.gz", "has_sig": false, "md5_digest": "f2f7ccd4ca2ff27dcaaa62bf0d2f4ef8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10538, "upload_time": "2018-06-20T04:53:59", "url": "https://files.pythonhosted.org/packages/c2/84/fdcccbf93aaafb9916cdc6fa988d5572d46ba97a10444f5e0ca253bc7994/d4-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "30d0989514717566e33220469613391d", "sha256": "2c899bcab60a763915a17765e970956456a34d374e926fbddb4a65ce42965762" }, "downloads": -1, "filename": "d4-0.1.10.tar.gz", "has_sig": false, "md5_digest": "30d0989514717566e33220469613391d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10543, "upload_time": "2018-06-20T05:03:25", "url": "https://files.pythonhosted.org/packages/4d/38/9cbad70c1ccfa0156b514dcd03f0b5df9263ff1face3d1902e1558e7ee74/d4-0.1.10.tar.gz" } ] }