Install surveil inside a virtualenv in Dockerfile

Change-Id: I7f060fbaa77ad9775a4b9dc1fb67ed0287bae539
This commit is contained in:
Vincent Fournier 2015-05-29 12:08:07 -04:00 committed by aviau
parent a79eb3de1f
commit 34b5fea7c3
3 changed files with 10 additions and 9 deletions

View File

@ -2,11 +2,13 @@ FROM ubuntu:trusty
MAINTAINER Alexandre Viau <alexandre.viau@savoirfairelinux.com>
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

View File

@ -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/

View File

@ -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: