Merge "Stop using master for pip"
[functest.git] / docker / Dockerfile
1 ########################################
2 #   Docker container for FUNCTEST
3 ########################################
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9
10 FROM ubuntu:14.04
11 MAINTAINER Jose Lausuch <jose.lausuch@ericsson.com>
12 LABEL version="0.1" description="OPNFV Functest Docker container"
13
14 # Environment variables
15 ARG BRANCH=master
16 ARG RALLY_TAG=stable/0.9
17 ARG ODL_TAG=release/carbon
18 ARG OPENSTACK_TAG=stable/ocata
19 ARG VIMS_TAG=stable
20 ARG REPOS_DIR=/home/opnfv/repos
21 ARG FUNCTEST_BASE_DIR=/home/opnfv/functest
22 ARG FUNCTEST_CONF_DIR=${FUNCTEST_BASE_DIR}/conf
23 ARG FUNCTEST_DATA_DIR=${FUNCTEST_BASE_DIR}/data
24 ARG FUNCTEST_IMAGES_DIR=${FUNCTEST_BASE_DIR}/images
25 ARG FUNCTEST_RESULTS_DIR=${FUNCTEST_BASE_DIR}/results
26 ARG FUNCTEST_DIR=/usr/local/lib/python2.7/dist-packages/functest/
27 ARG REPOS_VNFS_DIR=${REPOS_DIR}/vnfs
28
29 # Environment variables
30 ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_DIR}/ci/config_functest.yaml
31 ENV REPOS_DIR ${REPOS_DIR}
32 ENV creds ${FUNCTEST_CONF_DIR}/openstack.creds
33
34 # Packaged dependencies
35 RUN apt-get update && apt-get install -y \
36 build-essential \
37 bundler \
38 crudini \
39 curl \
40 dnsmasq \
41 gcc \
42 git \
43 libffi-dev \
44 libgmp3-dev \
45 libpq-dev \
46 libssl-dev \
47 libxml2-dev \
48 libxslt-dev \
49 libzmq3-dev \
50 python-dev \
51 python-mock \
52 python-pip \
53 postgresql \
54 ruby \
55 ruby-dev \
56 ruby-bundler \
57 ssh \
58 sshpass \
59 wget \
60 --no-install-recommends
61
62 RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
63
64 RUN mkdir -p ${REPOS_VNFS_DIR} \
65     && mkdir -p ${FUNCTEST_BASE_DIR}/results \
66     && mkdir -p ${FUNCTEST_CONF_DIR} \
67     && mkdir -p ${FUNCTEST_DATA_DIR} \
68     && mkdir -p ${FUNCTEST_IMAGES_DIR} \
69     && mkdir -p /root/.ssh \
70     && chmod 700 /root/.ssh
71
72 RUN git config --global http.sslVerify false
73
74 COPY thirdparty-requirements.txt thirdparty-requirements.txt
75 RUN wget -q -O- https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG | \
76         sed -E s/^tempest==+\(.*\)$/-e\ git+https:\\/\\/github.com\\/openstack\\/tempest@\\1#egg=tempest/ \
77         > upper-constraints.txt && \
78     pip install --src /src -cupper-constraints.txt \
79         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \
80         -e git+https://github.com/openstack/requirements@stable/ocata#egg=openstack_requirements && \
81     git clone --depth 1 https://github.com/openstack/rally.git -b $RALLY_TAG /src/rally && \
82     update-requirements -s --source /src/openstack-requirements /src/rally/ && \
83     pip install --src /src -cupper-constraints.txt \
84         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH /src/rally/ && \
85     pip install --src /src -cupper-constraints.txt \
86         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \
87         git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
88         -rthirdparty-requirements.txt && \
89     mkdir -p /etc/rally && \
90     printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \
91     mkdir -p /var/lib/rally/database && rally-manage db create && \
92     rm thirdparty-requirements.txt upper-constraints.txt
93
94 # OPNFV repositories
95 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/fds /src/fds
96
97 # other repositories
98 RUN git clone --depth 1 -b $ODL_TAG https://git.opendaylight.org/gerrit/p/integration/test.git /src/odl_test
99 RUN git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwater-live-test /src/vims-test
100
101 # Install tempest venv and create symlink for running refstack-client
102 RUN ln -s /src/tempest /src/refstack-client/.tempest \
103     && virtualenv --system-site-packages /src/tempest/.venv
104
105 RUN cd /src/vims-test && bundle install
106
107 RUN sh -c 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -' \
108     && sudo apt-get install -y nodejs \
109     && cd /src/promise && sudo npm -g install npm@latest \
110     && cd /src/promise/source && npm install
111
112 RUN echo ". ${FUNCTEST_DIR}/cli/functest-complete.sh" >> /root/.bashrc
113
114 CMD ["functest_restapi"]