xref: /aosp_15_r20/external/ot-br-posix/etc/docker/Dockerfile (revision 4a64e381480ef79f0532b2421e44e6ee336b8e0d)
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
28ARG BASE_IMAGE=ubuntu:bionic
29FROM ${BASE_IMAGE}
30
31ARG INFRA_IF_NAME
32ARG BORDER_ROUTING
33ARG BACKBONE_ROUTER
34ARG OT_BACKBONE_CI
35ARG OTBR_OPTIONS
36ARG DNS64
37ARG NAT64
38ARG NAT64_SERVICE
39ARG NAT64_DYNAMIC_POOL
40ARG REFERENCE_DEVICE
41ARG RELEASE
42ARG REST_API
43ARG WEB_GUI
44ARG MDNS
45ARG FIREWALL
46
47ENV INFRA_IF_NAME=${INFRA_IF_NAME:-eth0}
48ENV BORDER_ROUTING=${BORDER_ROUTING:-1}
49ENV BACKBONE_ROUTER=${BACKBONE_ROUTER:-1}
50ENV OT_BACKBONE_CI=${OT_BACKBONE_CI:-0}
51ENV OTBR_MDNS=${MDNS:-mDNSResponder}
52ENV OTBR_OPTIONS=${OTBR_OPTIONS}
53ENV DEBIAN_FRONTEND noninteractive
54ENV PLATFORM ubuntu
55ENV REFERENCE_DEVICE=${REFERENCE_DEVICE:-0}
56ENV RELEASE=${RELEASE:-1}
57ENV NAT64=${NAT64:-1}
58ENV NAT64_SERVICE=${NAT64_SERVICE:-openthread}
59ENV NAT64_DYNAMIC_POOL=${NAT64_DYNAMIC_POOL:-192.168.255.0/24}
60ENV DNS64=${DNS64:-0}
61ENV WEB_GUI=${WEB_GUI:-1}
62ENV REST_API=${REST_API:-1}
63ENV FIREWALL=${FIREWALL:-1}
64ENV DOCKER 1
65
66RUN env
67
68# Required during build or run
69ENV OTBR_DOCKER_REQS sudo python3
70
71# Required during build, could be removed
72ENV OTBR_DOCKER_DEPS git ca-certificates
73
74# Required and installed during build (script/bootstrap), could be removed
75ENV OTBR_BUILD_DEPS apt-utils build-essential psmisc ninja-build cmake wget ca-certificates \
76  libreadline-dev libncurses-dev libdbus-1-dev libavahi-common-dev \
77  libavahi-client-dev libboost-dev libboost-filesystem-dev libboost-system-dev \
78  libnetfilter-queue-dev
79
80# Required for OpenThread Backbone CI
81ENV OTBR_OT_BACKBONE_CI_DEPS curl lcov wget build-essential python3-dbus python3-zeroconf socat
82
83RUN apt-get update \
84  && apt-get install --no-install-recommends -y $OTBR_DOCKER_REQS $OTBR_DOCKER_DEPS \
85  && ([ "${OT_BACKBONE_CI}" != "1" ] || apt-get install --no-install-recommends -y $OTBR_OT_BACKBONE_CI_DEPS) \
86  && ln -fs /usr/share/zoneinfo/UTC /etc/localtime
87
88COPY ./script /app/script
89COPY ./third_party/mDNSResponder /app/third_party/mDNSResponder
90WORKDIR /app
91
92RUN ./script/bootstrap
93COPY . .
94RUN ./script/setup
95
96RUN ([ "${DNS64}" = "0" ] || chmod 644 /etc/bind/named.conf.options) \
97  && ([ "${OT_BACKBONE_CI}" = "1" ] || ( \
98    mv ./script /tmp \
99    && mv ./etc /tmp \
100    && find . -delete \
101    && rm -rf /usr/include \
102    && mv /tmp/script . \
103    && mv /tmp/etc . \
104    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $OTBR_DOCKER_DEPS \
105    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $OTBR_BUILD_DEPS  \
106    && rm -rf /var/lib/apt/lists/* \
107    && rm -rf /tmp/* \
108  ))
109
110ENTRYPOINT ["/app/etc/docker/docker_entrypoint.sh"]
111
112EXPOSE 80
113