diff options
author | Mickael JEZEQUEL <mickael.jezequel@orange.com> | 2018-03-09 17:44:34 +0100 |
---|---|---|
committer | Mickael JEZEQUEL <mickael.jezequel@orange.com> | 2018-03-15 13:45:50 +0100 |
commit | b071b23b024a07b5e0d9f1c915468384369e26af (patch) | |
tree | ac1ca80e07e1bf2bdffb79d26c37931348dd297a /docker/src/main | |
parent | dd79a38607c40db86de950b4c1ecdff443fe68f4 (diff) |
Dockerize rest API for ICE tests
Change-Id: I8928203bb76a20fb7d10fd05d06151e2c6b7a934
Issue-ID: VNFSDK-214
Signed-off-by: Mickael JEZEQUEL <mickael.jezequel@orange.com>
Diffstat (limited to 'docker/src/main')
-rw-r--r-- | docker/src/main/docker/Dockerfile | 29 | ||||
-rw-r--r-- | docker/src/main/docker/prod_settings.cfg | 8 | ||||
-rw-r--r-- | docker/src/main/docker/run.sh | 7 |
3 files changed, 44 insertions, 0 deletions
diff --git a/docker/src/main/docker/Dockerfile b/docker/src/main/docker/Dockerfile new file mode 100644 index 0000000..7b3f033 --- /dev/null +++ b/docker/src/main/docker/Dockerfile @@ -0,0 +1,29 @@ +FROM python:3.6.1 + +ENV ICE_SETTINGS /opt/ice/ice-server/heat_test/prod_settings.cfg +ENV DEBUG False +ENV MSB_ADDR "127.0.0.1" +ENV MSB_PORT 80 + +# add application +COPY maven/ /opt/ice +COPY prod_settings.cfg /opt/ice/ice-server/heat_test/ +COPY run.sh /opt/ice/ice-server/heat_test/ + +EXPOSE 5000 + +# install requirements +# Create the group and user to be used in this container +RUN pip install -r /opt/ice/ice-server/requirements.txt &&\ + pip install -r /opt/ice/validation-scripts/requirements.txt &&\ + pip install dumb-init &&\ + groupadd flaskgroup && useradd -m -g flaskgroup -s /bin/bash flask &&\ + chown -R flask:flaskgroup /opt/ice &&\ + chmod +x /opt/ice/ice-server/heat_test/*.sh + +USER flask +WORKDIR /opt/ice/ice-server/heat_test +# use dumb-init to translate SIGTERM to SIGINT +# this is needed to gracefully stop flask (and unregister service properly) +ENTRYPOINT ["dumb-init", "--rewrite", "15:2", "--"] +CMD ["./run.sh"] diff --git a/docker/src/main/docker/prod_settings.cfg b/docker/src/main/docker/prod_settings.cfg new file mode 100644 index 0000000..f623d76 --- /dev/null +++ b/docker/src/main/docker/prod_settings.cfg @@ -0,0 +1,8 @@ +# ICE production settings +DEBUG = False + +# MSB production settings +MSB_ADDR = "127.0.0.1" +MSB_PORT = "80" +MSB_URL = "http://%s:%s/api/microservices/v1/services" % (MSB_ADDR, MSB_PORT) + diff --git a/docker/src/main/docker/run.sh b/docker/src/main/docker/run.sh new file mode 100644 index 0000000..662c8cf --- /dev/null +++ b/docker/src/main/docker/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +sed -i "s/DEBUG =.*/DEBUG = ${DEBUG}/g" ${ICE_SETTINGS} +sed -i "s/MSB_ADDR =.*/MSB_ADDR = \"${MSB_ADDR}\"/g" ${ICE_SETTINGS} +sed -i "s/MSB_PORT =.*/MSB_PORT = \"${MSB_PORT}\"/g" ${ICE_SETTINGS} + +/usr/local/bin/python app.py
\ No newline at end of file |