Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / ot-br-posix / repo / etc / docker / Dockerfile
1 #  Copyright (c) 2018, The OpenThread Authors.
2 #  All rights reserved.
3 #
4 #  Redistribution and use in source and binary forms, with or without
5 #  modification, are permitted provided that the following conditions are met:
6 #  1. Redistributions of source code must retain the above copyright
7 #     notice, this list of conditions and the following disclaimer.
8 #  2. Redistributions in binary form must reproduce the above copyright
9 #     notice, this list of conditions and the following disclaimer in the
10 #     documentation and/or other materials provided with the distribution.
11 #  3. Neither the name of the copyright holder nor the
12 #     names of its contributors may be used to endorse or promote products
13 #     derived from this software without specific prior written permission.
14 #
15 #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 #  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 #  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 #  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 #  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 #  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 #  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 #  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 #  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 #  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 #  POSSIBILITY OF SUCH DAMAGE.
26 #
27
28 ARG BASE_IMAGE=ubuntu:bionic
29 FROM ${BASE_IMAGE}
30
31 ARG BACKBONE_ROUTER
32 ARG OT_BACKBONE_CI
33 ARG OTBR_OPTIONS
34 ARG DNS64
35 ARG NAT64
36 ARG REFERENCE_DEVICE
37 ARG RELEASE
38
39 ENV BACKBONE_ROUTER=${BACKBONE_ROUTER:-0}
40 ENV OT_BACKBONE_CI=${OT_BACKBONE_CI:-0}
41 ENV OTBR_OPTIONS=${OTBR_OPTIONS}
42 ENV DEBIAN_FRONTEND noninteractive
43 ENV PLATFORM ubuntu
44 ENV REFERENCE_DEVICE=${REFERENCE_DEVICE:-0}
45 ENV RELEASE=${RELEASE:-1}
46 ENV NAT64=${NAT64:-1}
47 ENV DNS64=${DNS64:-1}
48 ENV DOCKER 1
49
50 RUN env
51
52 COPY . /app
53 WORKDIR /app
54
55 # Required during build or run
56 ENV OTBR_DOCKER_REQS sudo
57
58 # Required during build, could be removed
59 ENV OTBR_DOCKER_DEPS git ca-certificates
60
61 # Required and installed during build (script/bootstrap), could be removed
62 ENV OTBR_BUILD_DEPS apt-utils build-essential psmisc ninja-build cmake wget ca-certificates \
63   libreadline-dev libncurses-dev libcpputest-dev libdbus-1-dev libavahi-common-dev \
64   libavahi-client-dev libboost-dev libboost-filesystem-dev libboost-system-dev libjsoncpp-dev \
65   libnetfilter-queue-dev
66
67 # Required for OpenThread Backbone CI
68 ENV OTBR_OT_BACKBONE_CI_DEPS curl lcov wget build-essential
69
70 # Required and installed during build (script/bootstrap) when RELEASE=1, could be removed
71 ENV OTBR_NORELEASE_DEPS \
72   cmake \
73   cpputest \
74   doxygen
75
76 RUN apt-get update \
77   && apt-get install --no-install-recommends -y $OTBR_DOCKER_REQS $OTBR_DOCKER_DEPS \
78   && [ "${OT_BACKBONE_CI}" != "1" ] || ( \
79     apt-get install --no-install-recommends -y $OTBR_OT_BACKBONE_CI_DEPS \
80     && MDNS_RESPONDER_SOURCE_NAME=mDNSResponder-878.30.4 \
81     && wget -4 --no-check-certificate https://opensource.apple.com/tarballs/mDNSResponder/$MDNS_RESPONDER_SOURCE_NAME.tar.gz \
82     && tar xvf $MDNS_RESPONDER_SOURCE_NAME.tar.gz \
83     && cd $MDNS_RESPONDER_SOURCE_NAME/mDNSPosix \
84     && make os=linux && sudo make install os=linux \
85     && cd - && rm -rf $MDNS_RESPONDER_SOURCE_NAME) \
86   && ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
87   && ./script/bootstrap \
88   && ./script/setup \
89   && chmod 644 /etc/bind/named.conf.options \
90   && [ "${OT_BACKBONE_CI}" = "1" ] || ( \
91     mv ./script /tmp \
92     && mv ./etc /tmp \
93     && find . -delete \
94     && rm -rf /usr/include \
95     && mv /tmp/script . \
96     && mv /tmp/etc . \
97     && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $OTBR_DOCKER_DEPS \
98     && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $OTBR_BUILD_DEPS  \
99     && ([ "${RELEASE}" = 1 ] ||  apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false "$OTBR_NORELEASE_DEPS";) \
100     && rm -rf /var/lib/apt/lists/* \
101   )
102
103 ENTRYPOINT ["/app/etc/docker/docker_entrypoint.sh"]
104
105 EXPOSE 80