[os] Fix python version
[validation.git] / docker / os / Dockerfile
1 ##############################################################################
2 # Copyright (c) 2019 AT&T, ENEA AB, Nokia and others                         #
3 #                                                                            #
4 # Licensed under the Apache License, Version 2.0 (the "License");            #
5 # you maynot use this file except in compliance with the License.            #
6 #                                                                            #
7 # You may obtain a copy of the License at                                    #
8 #       http://www.apache.org/licenses/LICENSE-2.0                           #
9 #                                                                            #
10 # Unless required by applicable law or agreed to in writing, software        #
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
13 # See the License for the specific language governing permissions and        #
14 # limitations under the License.                                             #
15 ##############################################################################
16
17 # ref: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds
18 FROM ubuntu:18.04 as build
19
20 # Install dependencies
21 COPY pip-requirements.txt /wheels/requirements/pip-requirements.txt
22 RUN apt-get update && apt-get -y install \
23     python3-pip \
24     gcc \
25     git \
26     libc-dev \
27     libffi6 \
28     libffi-dev \
29     make \
30     libssl-dev \
31     build-essential \
32     autoconf automake autotools-dev m4 \
33     linux-headers-generic \
34     libaio-dev libattr1-dev libcap-dev
35
36 # Build binaries
37 WORKDIR /wheels
38 RUN pip3 install wheel
39 RUN pip3 wheel -r /wheels/requirements/pip-requirements.txt
40 RUN git clone https://gerrit.akraino.org/r/validation /opt/akraino/validation
41
42 # Build ltp tests
43 RUN mkdir -p /opt/akraino /root/src
44 WORKDIR  /root/src
45 RUN git clone https://github.com/linux-test-project/ltp.git
46 WORKDIR /root/src/ltp
47 RUN make autotools && \
48     ./configure --prefix=/opt/ltp && \
49     make -j $(getconf _NPROCESSORS_ONLN) 2>&1 | tee ../build-log.txt && \
50     make install 2>&1 | tee ../install-log.txt
51 RUN tar czvf /opt/akraino/ltp.tar.gz /opt/ltp
52
53 # Copy binaries into the final container and install robot framework
54 FROM ubuntu:18.04
55 COPY --from=build /wheels /wheels
56 COPY --from=build /opt/akraino/validation /opt/akraino/validation
57 COPY --from=build /opt/akraino/ltp.tar.gz /opt/akraino/ltp.tar.gz
58
59 RUN apt-get update && apt-get -y install \
60     python3-pip python3.6 && \
61     cd /usr/bin && ln -s python3 python && \
62     pip3 install -r /wheels/requirements/pip-requirements.txt \
63                  -f /wheels && \
64     rm -rf /wheels && \
65     rm -rf /root/.cache/pip/* && \
66     rm -rf /var/cache/apt/* && \
67     rm -rf /var/lib/apt/lists/*
68
69 # Install bluval dependencies
70 RUN pip3 install -r /opt/akraino/validation/bluval/requirements.txt