Merge "Update Functest to OpenStack stable/pike"
[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.10
17 ARG OS_FAULTS_TAG=0.1.16
18 ARG ODL_TAG=e12ba90cd27577c4c6c70ee54f7d599b5f6777ba
19 ARG OPENSTACK_TAG=stable/ocata
20 ARG VIMS_TAG=stable
21 ARG REFSTACK_TAG=4e187b07672dd1c41cb7c94658f1c91edebf53a2
22 ARG REPOS_DIR=/home/opnfv/repos
23 ARG FUNCTEST_BASE_DIR=/home/opnfv/functest
24 ARG FUNCTEST_CONF_DIR=${FUNCTEST_BASE_DIR}/conf
25 ARG FUNCTEST_DATA_DIR=${FUNCTEST_BASE_DIR}/data
26 ARG FUNCTEST_IMAGES_DIR=${FUNCTEST_BASE_DIR}/images
27 ARG FUNCTEST_RESULTS_DIR=${FUNCTEST_BASE_DIR}/results
28 ARG FUNCTEST_DIR=/usr/local/lib/python2.7/dist-packages/functest/
29 ARG REPOS_VNFS_DIR=${REPOS_DIR}/vnfs
30
31 # Environment variables
32 ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_DIR}/ci/config_functest.yaml
33 ENV REPOS_DIR ${REPOS_DIR}
34 ENV creds ${FUNCTEST_CONF_DIR}/openstack.creds
35
36 # Packaged dependencies
37 RUN apt-get update && apt-get install -y \
38 build-essential \
39 bundler \
40 crudini \
41 curl \
42 dnsmasq \
43 gcc \
44 git \
45 libffi-dev \
46 libgmp3-dev \
47 libpq-dev \
48 libssl-dev \
49 libxml2-dev \
50 libxslt-dev \
51 libzmq3-dev \
52 python-dev \
53 python-mock \
54 python-pip \
55 python3 \
56 python3-dev \
57 python3-pip \
58 postgresql \
59 ruby \
60 ruby-dev \
61 ruby-bundler \
62 ssh \
63 sshpass \
64 wget \
65 --no-install-recommends
66
67 RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
68 RUN python3 -m pip install --upgrade pip setuptools==30.0.0
69
70 RUN mkdir -p ${REPOS_VNFS_DIR} \
71     && mkdir -p ${FUNCTEST_BASE_DIR}/results \
72     && mkdir -p ${FUNCTEST_CONF_DIR} \
73     && mkdir -p ${FUNCTEST_DATA_DIR} \
74     && mkdir -p ${FUNCTEST_IMAGES_DIR} \
75     && mkdir -p /root/.ssh \
76     && chmod 700 /root/.ssh
77
78 RUN git config --global http.sslVerify false
79
80 COPY thirdparty-requirements.txt thirdparty-requirements.txt
81 RUN wget -q -O- https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG | \
82         sed -E s/^tempest==+\(.*\)$/-e\ git+https:\\/\\/github.com\\/openstack\\/tempest@\\1#egg=tempest/ | \
83         sed s/^requests===.*$/requests===2.13.0/ \
84         > upper-constraints.txt && \
85     pip install --src /src -cupper-constraints.txt \
86         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \
87         -e git+https://github.com/openstack/requirements@$OPENSTACK_TAG#egg=openstack_requirements && \
88     git clone --depth 1 https://github.com/openstack/os-faults.git -b $OS_FAULTS_TAG /src/os-faults && \
89     update-requirements -s --source /src/openstack-requirements /src/os-faults/ && \
90     git clone --depth 1 https://github.com/openstack/rally.git -b $RALLY_TAG /src/rally && \
91     update-requirements -s --source /src/openstack-requirements /src/rally && \
92     git clone https://github.com/openstack/refstack-client.git /src/refstack-client && \
93     (cd src/refstack-client && git checkout $REFSTACK_TAG) && \
94     update-requirements -s --source /src/openstack-requirements /src/refstack-client && \
95     pip install --src /src -cupper-constraints.txt \
96         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \
97         /src/os-faults /src/rally -e/src/refstack-client && \
98     pip install --src /src -cupper-constraints.txt \
99         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \
100         git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
101         -rthirdparty-requirements.txt && \
102     python3 -m pip install --src /src \
103         -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \
104         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \
105         doctor-tests && \
106     mkdir -p /etc/rally && \
107     printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \
108     mkdir -p /var/lib/rally/database && rally-manage db create && \
109     rm thirdparty-requirements.txt upper-constraints.txt
110
111 # OPNFV repositories
112 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/fds /src/fds
113
114 # other repositories
115 RUN git clone https://git.opendaylight.org/gerrit/p/integration/test.git /src/odl_test && \
116         (cd src/odl_test && git checkout $ODL_TAG)
117 RUN git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwater-live-test /src/vims-test
118
119 # Install tempest venv and create symlink for running refstack-client
120 RUN ln -s /src/tempest /src/refstack-client/.tempest \
121     && virtualenv --system-site-packages /src/tempest/.venv --python=python2
122
123 RUN cd /src/vims-test && bundle install
124
125 RUN sh -c 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -' \
126     && sudo apt-get install -y nodejs \
127     && cd /src/promise && sudo npm -g install npm@latest \
128     && cd /src/promise/source && npm install
129
130 RUN echo ". ${FUNCTEST_DIR}/cli/functest-complete.sh" >> /root/.bashrc
131
132 CMD ["functest_restapi"]