From 8758435d404e21815ebd98c932cd08749d56ef4b Mon Sep 17 00:00:00 2001
From: Swapnil Kulkarni <me@coolsvap.net>
Date: Wed, 19 Aug 2015 05:23:05 +0000
Subject: [PATCH] Add Dockerfile template for Gnocchi

Change-Id: I15e6a06645361aec979d7dad4794b45236c957e3
Partially-Implements: blueprint dockerfile-template
---
 .../gnocchi/gnocchi-api/Dockerfile.j2         | 18 ++++++++++++++
 .../gnocchi/gnocchi-api/config-external.sh    |  1 +
 docker_templates/gnocchi/gnocchi-api/start.sh |  1 +
 .../gnocchi/gnocchi-base/Dockerfile.j2        | 24 +++++++++++++++++++
 .../gnocchi/gnocchi-statsd/Dockerfile.j2      | 16 +++++++++++++
 .../gnocchi/gnocchi-statsd/config-external.sh |  1 +
 .../gnocchi/gnocchi-statsd/start.sh           |  1 +
 7 files changed, 62 insertions(+)
 create mode 100644 docker_templates/gnocchi/gnocchi-api/Dockerfile.j2
 create mode 120000 docker_templates/gnocchi/gnocchi-api/config-external.sh
 create mode 120000 docker_templates/gnocchi/gnocchi-api/start.sh
 create mode 100644 docker_templates/gnocchi/gnocchi-base/Dockerfile.j2
 create mode 100644 docker_templates/gnocchi/gnocchi-statsd/Dockerfile.j2
 create mode 120000 docker_templates/gnocchi/gnocchi-statsd/config-external.sh
 create mode 120000 docker_templates/gnocchi/gnocchi-statsd/start.sh

diff --git a/docker_templates/gnocchi/gnocchi-api/Dockerfile.j2 b/docker_templates/gnocchi/gnocchi-api/Dockerfile.j2
new file mode 100644
index 0000000000..93d8214764
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-api/Dockerfile.j2
@@ -0,0 +1,18 @@
+FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-gnocchi-base:{{ tag }}
+MAINTAINER Kolla Project (https://launchpad.net/kolla)
+
+{% if install_type == 'binary' %}
+    {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %}
+
+RUN yum install -y openstack-gnocchi-api \
+    openstack-gnocchi-carbonara \
+    openstack-gnocchi-indexer-sqlalchemy \
+    && yum clean all
+
+    {% endif %}
+{% endif %}
+
+COPY start.sh /
+COPY config-external.sh /opt/kolla/
+
+CMD ["/start.sh"]
diff --git a/docker_templates/gnocchi/gnocchi-api/config-external.sh b/docker_templates/gnocchi/gnocchi-api/config-external.sh
new file mode 120000
index 0000000000..ef5155846f
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-api/config-external.sh
@@ -0,0 +1 @@
+../../../docker/common/gnocchi/gnocchi-api/config-external.sh
\ No newline at end of file
diff --git a/docker_templates/gnocchi/gnocchi-api/start.sh b/docker_templates/gnocchi/gnocchi-api/start.sh
new file mode 120000
index 0000000000..92849bb3d4
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-api/start.sh
@@ -0,0 +1 @@
+../../../docker/common/gnocchi/gnocchi-api/start.sh
\ No newline at end of file
diff --git a/docker_templates/gnocchi/gnocchi-base/Dockerfile.j2 b/docker_templates/gnocchi/gnocchi-base/Dockerfile.j2
new file mode 100644
index 0000000000..db82205244
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-base/Dockerfile.j2
@@ -0,0 +1,24 @@
+FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }}
+MAINTAINER Kolla Project (https://launchpad.net/kolla)
+
+{% if install_type == 'binary' %}
+    {% if base_distro in ['ubuntu', 'debian'] %}
+
+RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
+    && /bin/false
+
+    {% endif %}
+{% elif install_type == 'source' %}
+
+ADD ./gnocchi.tar /
+RUN ln -s /gnocchi-* /gnocchi
+
+RUN cd /gnocchi \
+    && useradd --user-group gnocchi \
+    && pip install -r requirements.txt \
+    && pip install /gnocchi \
+    && mkdir /etc/gnocchi /var/log/gnocchi \
+    && cp -r /gnocchi/etc/* /etc/gnocchi/ \
+    && rm -rf /root/.cache
+
+{% endif %}
diff --git a/docker_templates/gnocchi/gnocchi-statsd/Dockerfile.j2 b/docker_templates/gnocchi/gnocchi-statsd/Dockerfile.j2
new file mode 100644
index 0000000000..446c47d1c9
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-statsd/Dockerfile.j2
@@ -0,0 +1,16 @@
+FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-gnocchi-base:{{ tag }}
+MAINTAINER Kolla Project (https://launchpad.net/kolla)
+
+{% if install_type == 'binary' %}
+    {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %}
+
+RUN yum install -y openstack-gnocchi-statsd \
+    && yum clean all
+
+    {% endif %}
+{% endif %}
+
+COPY start.sh /
+COPY config-external.sh /opt/kolla/
+
+CMD ["/start.sh"]
diff --git a/docker_templates/gnocchi/gnocchi-statsd/config-external.sh b/docker_templates/gnocchi/gnocchi-statsd/config-external.sh
new file mode 120000
index 0000000000..a3d14b10e5
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-statsd/config-external.sh
@@ -0,0 +1 @@
+../../../docker/common/gnocchi/gnocchi-statsd/config-external.sh
\ No newline at end of file
diff --git a/docker_templates/gnocchi/gnocchi-statsd/start.sh b/docker_templates/gnocchi/gnocchi-statsd/start.sh
new file mode 120000
index 0000000000..d273687080
--- /dev/null
+++ b/docker_templates/gnocchi/gnocchi-statsd/start.sh
@@ -0,0 +1 @@
+../../../docker/common/gnocchi/gnocchi-statsd/start.sh
\ No newline at end of file
-- 
GitLab