From 16223ff63957ccc3b98d08cea473460f3b6e6b4a Mon Sep 17 00:00:00 2001
From: Sam Yaple <sam@yaple.net>
Date: Wed, 12 Aug 2015 02:49:35 +0000
Subject: [PATCH] Add Dockerfile template for rabbitmq

Change-Id: Ic42879451cba2fb7fa35764924ca191949c477c4
Partially-Implements: blueprint dockerfile-template
---
 docker_templates/rabbitmq/Dockerfile.j2      | 25 ++++++++++++++++++++
 docker_templates/rabbitmq/config-external.sh |  1 +
 docker_templates/rabbitmq/config-rabbit.sh   |  1 +
 docker_templates/rabbitmq/start.sh           |  1 +
 tools/build.py                               |  4 +++-
 5 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 docker_templates/rabbitmq/Dockerfile.j2
 create mode 120000 docker_templates/rabbitmq/config-external.sh
 create mode 120000 docker_templates/rabbitmq/config-rabbit.sh
 create mode 120000 docker_templates/rabbitmq/start.sh

diff --git a/docker_templates/rabbitmq/Dockerfile.j2 b/docker_templates/rabbitmq/Dockerfile.j2
new file mode 100644
index 0000000000..63dc1ff3c2
--- /dev/null
+++ b/docker_templates/rabbitmq/Dockerfile.j2
@@ -0,0 +1,25 @@
+FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }}
+MAINTAINER Kolla Project (https://launchpad.net/kolla)
+
+{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %}
+
+RUN yum -y install \
+        hostname \
+        rabbitmq-server \
+    && yum clean all
+
+{% elif base_distro in ['ubuntu', 'debian'] %}
+
+RUN apt-get install -y --no-install-recommends \
+        hostname \
+        rabbitmq-server \
+    && apt-get clean
+
+{% endif %}
+
+RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
+
+COPY start.sh /
+COPY config-rabbit.sh config-external.sh /opt/kolla/
+
+CMD ["/start.sh"]
diff --git a/docker_templates/rabbitmq/config-external.sh b/docker_templates/rabbitmq/config-external.sh
new file mode 120000
index 0000000000..d0f0563db9
--- /dev/null
+++ b/docker_templates/rabbitmq/config-external.sh
@@ -0,0 +1 @@
+../../docker/common/rabbitmq/config-external.sh
\ No newline at end of file
diff --git a/docker_templates/rabbitmq/config-rabbit.sh b/docker_templates/rabbitmq/config-rabbit.sh
new file mode 120000
index 0000000000..af4be1bf96
--- /dev/null
+++ b/docker_templates/rabbitmq/config-rabbit.sh
@@ -0,0 +1 @@
+../../docker/common/rabbitmq/config-rabbit.sh
\ No newline at end of file
diff --git a/docker_templates/rabbitmq/start.sh b/docker_templates/rabbitmq/start.sh
new file mode 120000
index 0000000000..5a3f6c74c3
--- /dev/null
+++ b/docker_templates/rabbitmq/start.sh
@@ -0,0 +1 @@
+../../docker/common/rabbitmq/start.sh
\ No newline at end of file
diff --git a/tools/build.py b/tools/build.py
index 2a17a6452c..9fc134882e 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -191,7 +191,9 @@ class KollaWorker(object):
             template = env.get_template(template_name)
             values = {'base_distro': self.base,
                       'base_distro_tag': self.base_tag,
-                      'install_type': self.type_}
+                      'install_type': self.type_,
+                      'namespace': self.namespace,
+                      'tag': self.tag}
             content = template.render(values)
             with open(os.path.join(path, 'Dockerfile'), 'w') as f:
                 f.write(content)