From: diazb Date: Thu, 5 Apr 2018 01:17:53 +0000 (-0300) Subject: Adds Dockerfile X-Git-Tag: v4.0.0~20 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F38%2F5938%2F3;p=osm%2FMON.git Adds Dockerfile Adds script to generate config from env vars to use in Dockerfile Signed-off-by: Benjamin Diaz Change-Id: Ia6cb61320465769f6e2b628212d32adddf27e2b9 --- diff --git a/policy_module/Dockerfile b/policy_module/Dockerfile new file mode 100644 index 0000000..aa882bc --- /dev/null +++ b/policy_module/Dockerfile @@ -0,0 +1,36 @@ +# Copyright 2018 Whitestack, LLC +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Whitestack, LLC + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: bdiaz@whitestack.com or glavado@whitestack.com +## + +FROM ubuntu:16.04 + +LABEL authors="Benjamín Díaz" + +ADD . /policy_module + +RUN apt-get --yes update \ + && apt-get --yes install software-properties-common python-software-properties \ + && apt-get --yes install git python python-pip sudo libmysqlclient-dev libxext-dev libxrender-dev libxtst-dev \ + && pip install /policy_module \ + && pip install --upgrade pip \ + && pip install -r /policy_module/requirements.txt + +CMD bash /policy_module/scripts/gen_config_from_env.sh && osm-policy-agent --config osm_policy_agent.cfg \ No newline at end of file diff --git a/policy_module/osm_policy_agent.cfg b/policy_module/osm_policy_agent.cfg new file mode 100644 index 0000000..54ca70a --- /dev/null +++ b/policy_module/osm_policy_agent.cfg @@ -0,0 +1,3 @@ +[osm] +kafka_server_host=server +kafka_server_port=port diff --git a/policy_module/scripts/gen_config_from_env.sh b/policy_module/scripts/gen_config_from_env.sh new file mode 100644 index 0000000..fb71c82 --- /dev/null +++ b/policy_module/scripts/gen_config_from_env.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +CONFIG_FILENAME="osm_policy_agent.cfg" +rm $CONFIG_FILENAME 2> /dev/null +touch $CONFIG_FILENAME +echo "[policy_module]" >> $CONFIG_FILENAME +if ! [[ -z "${BROKER_URI}" ]]; then + HOST=$(echo $BROKER_URI | cut -d: -f1) + PORT=$(echo $BROKER_URI | cut -d: -f2) + echo "kafka_server_host=$HOST" >> $CONFIG_FILENAME + echo "kafka_server_port=$PORT" >> $CONFIG_FILENAME +fi \ No newline at end of file