Build the docker image by using ansible

Registered by Jeffrey Zhang on 2016-07-02

Kolla use Dockerfile to build the image. But there are many disadvantage of the
Dockerfile.

Dockerfille is almost a bunch of shell scripts. scripts are bad, that why we
using Ansible to deploy the kolla. It is hard to handle the complex environment
in different Linux distro and different distro release. For example, when need
detect the docker image distro, we are using following trick now.

..

    RUN if [ $(awk '{match($0, /[0-9]+/,version)}END{print version[0]}' /etc/system-release) != "{{ supported_distro_release }}" ]; then \
        echo "Only supported {{ supported_distro_release }} release on {{ base_distro }}"; false; \
    fi \

The scripts is not idempotent. For example, when creating a user, you must test
whether this user exist.

..
    RUN id -u ceph &> /dev/null || useradd --user-group ceph

there ugly and can not be reused. Moreover, the shell script logical is hard to
read and maintain.

Dockerfile is also hard to extend and modify. We have no mechanism to extend
one certain Dockerfile easily now. And it is also hard to change the repository
location, too.

Current Dockerfile also has many useless and meaningless layers, which are
never be shared with others images. Merging these layers into one has much
benefit. For example, it is no need to run some cleanup script at each of
``RUN`` directive. This can be done in the last of the playbooks and can speed
up the build process.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Jeffrey Zhang
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.