1. Update Dockerfile for CI build. But there is dependency on Intel System Studio...
[o-du/phy.git] / Dockerfile
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
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,          #
12 #   WITHOUT 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 FROM centos:centos7.7.1908 AS builder
17
18 ENV https_proxy $https_proxy
19 ENV http_proxy $http_proxy
20 ENV no_proxy $no_proxy
21
22 ARG icc_license_file
23
24 WORKDIR /opt/o-du/phy
25 ENV BUILD_DIR /opt/o-du/phy
26 ENV XRAN_DIR $BUILD_DIR/fhi_lib
27
28 ###Install required libs
29 RUN yum update -y && \
30     yum install -y libhugetlbfs-utils libhugetlbfs-devel libhugetlbfs numactl-devel ethtool gcc make module-init-tools kmod patch xz iproute pciutils python vim cmake unzip nano mc iputils-ping libaio libaio-devel net-tools  wget zip
31
32 ###Install some libs to compile DPDK
33 RUN yum groupinstall -y "Development Tools"
34 RUN yum install -y  ncurses-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel bc libstdc++-4.8.5-28.el7_5.1.x86_64 gcc-c++ libstdc++-devel-4.8.5-28.el7_5.1.x86_64 autoconf-2.69-11.el7.noarch
35
36 ###googletest is required for XRAN unittests build and run
37 RUN wget https://github.com/google/googletest/archive/v1.8.x.zip && \
38     cd /opt && unzip $BUILD_DIR/v1.8.x.zip
39 ENV GTEST_ROOT /opt/googletest-1.8.x/googletest
40 ENV GTEST_DIR /opt/googletest-1.8.x/googletest
41 RUN cd $GTEST_DIR && \
42     g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} -pthread -c ${GTEST_DIR}/src/gtest-all.cc && \
43     ar -rv libgtest.a gtest-all.o
44
45
46 ###Before install ISS, please go to Intel site to get a free license: https://software.intel.com/en-us/system-studio/choose-download
47 COPY $icc_license_file $BUILD_DIR/license.lic
48
49 ####Download Intel System Studio from Intel website and install ICC
50 RUN wget https://registrationcenter-download.intel.com/akdlm/irc_nas/16242/system_studio_2020_ultimate_edition_offline.tar.gz && \
51     cd /opt && mkdir intel && cp $BUILD_DIR/license.lic intel/license.lic && \
52     tar -zxvf $BUILD_DIR/system_studio_2020_ultimate_edition_offline.tar.gz && \
53     cd system_studio_2020_ultimate_edition_offline/ && \
54     sed -i "s/ACCEPT_EULA.*/ACCEPT_EULA=accept/" silent.cfg && \
55     sed -i "s/PSET_INSTALL_DIR.*/PSET_INSTALL_DIR=\/opt\/intel/" silent.cfg && \
56     sed -i "s/.*ACTIVATION_LICENSE_FILE.*/ACTIVATION_LICENSE_FILE=\/opt\/intel\/license.lic/" silent.cfg && \
57     sed -i "s/ACTIVATION_TYPE.*/ACTIVATION_TYPE=license_file/" silent.cfg && \
58     ./install.sh -s silent.cfg
59
60 ###Set env for ICC
61 RUN source /opt/intel/system_studio_2020/bin/iccvars.sh intel64
62 ENV PATH /opt/intel/system_studio_2020/bin/:$PATH
63
64 ####Download and build DPDK
65 ENV RTE_TARGET x86_64-native-linuxapp-icc
66 ENV RTE_SDK /opt/o-du/dpdk-18.08
67 RUN wget http://fast.dpdk.org/rel/dpdk-18.08.tar.xz && \
68     tar -xf dpdk-18.08.tar.xz && \
69     mv dpdk-18.08 $RTE_SDK && \
70     cd $RTE_SDK && \
71     make config T=$RTE_TARGET O=$RTE_TARGET && \
72     cd $RTE_SDK/$RTE_TARGET && \
73     sed -i "s/CONFIG_RTE_EAL_IGB_UIO=y/CONFIG_RTE_EAL_IGB_UIO=n/"  .config && \
74     sed -i "s/CONFIG_RTE_KNI_KMOD=y/CONFIG_RTE_KNI_KMOD=n/"  .config && \
75     make 
76
77 ####Install octave. Issue when downloading octave. And the octave will take 500MB space.
78 RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y && \
79     yum install octave -y
80
81 ###Copy XRAN source code into docker image
82 COPY fhi_lib $BUILD_DIR/fhi_lib
83 COPY misc $BUILD_DIR/misc
84
85 ####Build XRAN lib, unittests, sample app
86 RUN cd $BUILD_DIR/fhi_lib/ && ./build.sh xclean && ./build.sh && cd app && octave gen_test.m
87
88 ####Unset network proxy
89 RUN unset http_proxy https_prox ftp_proxy no_proxy
90
91 FROM centos:centos7.7.1908
92 ENV TARGET_DIR /opt/o-du/phy
93 COPY --from=builder /opt/o-du/phy/fhi_lib $TARGET_DIR/fhi_lib
94 COPY --from=builder /opt/o-du/phy/misc $TARGET_DIR/misc
95 COPY --from=builder  /usr/lib64/libnuma* /usr/lib64/
96 ENV XRAN_DIR $TARGET_DIR/fhi_lib
97 WORKDIR $TARGET_DIR/fhi_lib
98
99 LABEL description="ORAN Fronthaul Sample Application"
100