Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / infra / docker / bionic / Dockerfile.aarch64
1 # Copyright 2016-2020 Jing Li
2 # Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
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 ubuntu:18.04
17
18 ARG UBUNTU_MIRROR
19
20 # Install 'add-apt-repository'
21 RUN apt-get update && apt-get -qqy install software-properties-common
22
23 # Git repo for latest version (github checkout@v2 action requires v2.18)
24 RUN add-apt-repository ppa:git-core/ppa -y
25
26 # Build tool
27 RUN apt-get update && apt-get -qqy install build-essential cmake scons git g++-arm-linux-gnueabihf
28
29 # ARM none eabi build tool
30 RUN apt-get update && apt-get -qqy install gcc-arm-none-eabi
31
32 # Debian build tool
33 RUN apt-get update && apt-get -qqy install fakeroot devscripts debhelper python3-all
34
35 # Install extra dependencies (Caffe, nnkit)
36 RUN apt-get update && apt-get -qqy install libboost-all-dev libgflags-dev libgoogle-glog-dev libatlas-base-dev libhdf5-dev
37
38 # Install protocol buffer
39 RUN apt-get update && apt-get -qqy install libprotobuf-dev protobuf-compiler
40
41 # Additonal tools
42 RUN apt-get update && \
43     DEBIAN_FRONTEND=noninteractive \
44     apt-get -qqy install doxygen graphviz wget zip unzip clang-format-8 python3 python3-pip python3-venv python3-dev hdf5-tools pylint curl
45 RUN apt-get update && apt-get -qqy install python3.8 python3.8-venv python3.8-dev
46 RUN python3 -m pip install --upgrade pip
47 RUN python3 -m pip install yapf==0.22.0 numpy flatbuffers
48 RUN python3.8 -m pip install --upgrade pip
49 RUN python3.8 -m pip install numpy flatbuffers
50
51 # Install google test (source)
52 RUN apt-get update && apt-get -qqy install libgtest-dev
53
54 # Install build tool gcc version 8.x and set alternative link (c++17 support)
55 RUN apt-get update && apt-get -qqy install g++-8 g++-8-arm-linux-gnueabihf
56 RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 \
57     --slave /usr/bin/g++ g++ /usr/bin/g++-8 \
58     --slave /usr/bin/gcov gcov /usr/bin/gcov-8
59 RUN update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-8 80 \
60     --slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-8 \
61     --slave /usr/bin/arm-linux-gnueabihf-gcov arm-linux-gnueabihf-gcov /usr/bin/arm-linux-gnueabihf-gcov-8
62
63 # Install lcov 1.14-2 for gcc-8 support
64 #   Default version lcov 1.13-3 can't support gcc-8
65 #   lcov 1.13-4 with gcc-8 have bug: reports no coverage for class declaration
66 WORKDIR /root/lcov
67 RUN wget http://archive.ubuntu.com/ubuntu/pool/universe/l/lcov/lcov_1.14-2_all.deb
68 RUN apt-get update && apt-get -qqy install libperlio-gzip-perl libjson-perl
69 RUN dpkg -i lcov_1.14-2_all.deb
70 WORKDIR /root
71 RUN rm -rf /root/lcov
72
73 # Build and install google test static libraries
74 WORKDIR /root/gtest
75 RUN cmake /usr/src/gtest
76 RUN make
77 RUN mv *.a /usr/lib
78 WORKDIR /root
79 RUN rm -rf gtest
80
81 # Setup user to match host user, and give superuser permissions
82 ARG USER_ID=1000
83 ARG GROUP_ID=${USER_ID}
84 RUN addgroup --gid ${GROUP_ID} ubuntu && adduser --disabled-password --gecos '' --uid ${USER_ID} --gid ${GROUP_ID} ubuntu && usermod -aG sudo ubuntu
85 RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
86 RUN echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
87
88 # Clean archives (to reduce image size)
89 RUN apt-get clean -y
90
91 # Set user to the one we just created
92 USER ${USER_ID}