diff --git a/Dockerfile b/Dockerfile index 2dfb2b6..27755ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,13 @@ FROM ubuntu:trusty MAINTAINER Alexandre Viau -RUN apt-get update && apt-get install -y vim python-pip python3-pip python-dev libffi-dev libssl-dev git python-pycurl +RUN apt-get update && apt-get install -y vim python-pip python3-pip python-dev libffi-dev libssl-dev git python-pycurl python-virtualenv libcurl4-openssl-dev + +# VirtualEnv +RUN virtualenv /opt/surveil/env # Surveil needs alignak (as a lib) -RUN useradd shinken && pip install https://github.com/Alignak-monitoring/alignak/archive/396d10105827f8c75686811991829548e6778e11.zip - +RUN useradd shinken && /opt/surveil/env/bin/pip install pycurl https://github.com/Alignak-monitoring/alignak/archive/396d10105827f8c75686811991829548e6778e11.zip # Download packs ENV MONITORING_TOOLS_VERSION 0.2.0 @@ -20,7 +22,7 @@ RUN apt-get install -y subversion && \ apt-get remove -y subversion ADD requirements.txt /opt/surveil/requirements.txt -RUN pip install -r /opt/surveil/requirements.txt +RUN /opt/surveil/env/bin/pip install -r /opt/surveil/requirements.txt ADD tools/docker/surveil_container/setup.sh /opt/surveil/setup.sh ADD setup.py /opt/surveil/setup.py @@ -31,11 +33,10 @@ ADD surveil /opt/surveil/surveil #ADD .git /surveil/.git ENV PBR_VERSION=PROD -RUN pip install -U six # We are using develop so that the code can be mounted when in DEV. -RUN pip install -U six requests -RUN cd /opt/surveil && python setup.py develop +RUN cd /opt/surveil && /opt/surveil/env/bin/python setup.py develop +ENV PATH=$PATH:/opt/surveil/env/bin # Set to 'surveil' or 'keystone' ENV SURVEIL_AUTH_BACKEND=surveil diff --git a/docker-compose-production.yml b/docker-compose-production.yml index 87ec65c..9840e0a 100644 --- a/docker-compose-production.yml +++ b/docker-compose-production.yml @@ -36,7 +36,7 @@ rabbitconsumer: #SURVEIL_OS_PASSWORD: "password" #SURVEIL_TENANT_NAME: "admin" #SURVEIL_DEFAULT_TAGS: "linux-openstackceilometer" - command: bash -c "cd /opt/surveil && ./setup.sh && python setup.py develop && surveil-rabbitMQ-consumer" + command: bash -c "cd /opt/surveil && ./setup.sh && /opt/surveil/env/bin/python setup.py develop && surveil-rabbitMQ-consumer" alignak: #build: tools/docker/alignak_container/ diff --git a/docker-compose.yml b/docker-compose.yml index d3234bf..92a4d0d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ surveil: PBR_VERSION: "DEV" volumes: - ./surveil:/opt/surveil/surveil - command: bash -c "cd /opt/surveil && ./setup.sh && python setup.py develop && ((sleep 40 && surveil-init --demo) &) && sleep 20 && surveil-api --reload" + command: bash -c "cd /opt/surveil && ./setup.sh && /opt/surveil/env/bin/python setup.py develop && ((sleep 40 && surveil-init --demo) &) && sleep 20 && surveil-api --reload" # privileged: true # Fedora users might want to uncomment this if they face permission issues alignak: