diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2020-02-14 11:03:02 +0100 |
|---|---|---|
| committer | Radosław Piliszek <radoslaw.piliszek@gmail.com> | 2020-05-20 11:53:24 +0200 |
| commit | f3f471b41e6702d30ff45b4fb25b8b84bb030b52 (patch) | |
| tree | 1c6e9ca9940f53368b11708ab002902a4206d24b /doc/source/contributor/adding-a-new-image.rst | |
| parent | 629a2955f4c7838aae526f5af8c81db96f34a8b4 (diff) | |
| download | kolla-f3f471b41e6702d30ff45b4fb25b8b84bb030b52.tar.gz kolla-f3f471b41e6702d30ff45b4fb25b8b84bb030b52.zip | |
[Community goal] Update the contributor guide
Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Change-Id: I50e2bf6aac38624851edb15ecb108cade469ddad
Story: #2007236
Task: #38531
Diffstat (limited to 'doc/source/contributor/adding-a-new-image.rst')
| -rw-r--r-- | doc/source/contributor/adding-a-new-image.rst | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/doc/source/contributor/adding-a-new-image.rst b/doc/source/contributor/adding-a-new-image.rst new file mode 100644 index 000000000..db3f19b50 --- /dev/null +++ b/doc/source/contributor/adding-a-new-image.rst @@ -0,0 +1,52 @@ +================== +Adding a new image +================== + +Kolla follows `Best practices for writing Dockerfiles +<https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/>`__ +where at all possible. + +We use ``jinja2`` templating syntax to help manage the volume and complexity +that comes with maintaining multiple Dockerfiles for multiple different base +operating systems. + +Images should be created under the ``docker`` directory. OpenStack services +should inherit from the provided ``openstack-base`` image, and +infrastructure services (for example: ``fluentd``) should inherit from +``base``. + +Projects consisting of only one service should be placed in an image named the +same as that service, for example: ``horizon``. Services that consist of +multiple processes generally use a base image and child images, for example: +``cinder-base``, ``cinder-api``, ``cinder-scheduler``, ``cinder-volume``, +``cinder-backup``. + +Jinja2 `blocks` are employed throughout the Dockerfiles to help operators +customise various stages of the build (refer to :ref:`Dockerfile Customisation +<dockerfile-customisation>`) + +Some of these blocks are free form. However, there is a subset that should be +common to every Dockerfile. The overall structure is as follows: + +.. code-block:: console + + FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} + LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + + {% block << service >>_header %}{% endblock %} + + {% import "macros.j2" as macros with context %} + + << binary specific steps >> + + << source specific steps >> + + << common steps >> + + {% block << service >>_footer %}{% endblock %} + {% block footer %}{% endblock %} + +.. note:: + + The generic footer block ``{% block footer %}{% endblock %}`` should **not** be + included in base images (for example: ``cinder-base``). |
