1# Create Docker image that can be used for testing Zephyr network
2# sample applications.
3
4FROM gcc:bookworm
5
6# Get all the extra app we need in the container
7RUN apt update && apt install -y \
8    dante-server \
9    curl \
10    netcat-traditional \
11    tcpdump \
12    default-jre-headless \
13    dnsmasq \
14    iproute2 \
15    iputils-ping
16
17# We need the net-tools project as it contains helper apps needed
18# in testing.
19RUN git clone https://github.com/zephyrproject-rtos/net-tools.git && \
20    cd /net-tools && \
21    make tunslip6 && make echo-client && \
22    make echo-server && make throughput-client && \
23    make coap-client
24
25# linuxptp daemon is needed in gPTP testing
26RUN git clone https://git.code.sf.net/p/linuxptp/code linuxptp && \
27    cd /linuxptp && \
28    git checkout v3.1 && \
29    make && \
30    make install
31
32# MQTT testing
33RUN git clone https://github.com/eclipse/mosquitto.git && \
34    cd /mosquitto && \
35    git checkout v1.6.9 && \
36    make binary && \
37    install -d /usr/local/bin/ && \
38    install -d /usr/local/sbin/ && \
39    install -d /usr/local/lib/ && \
40    install -d /usr/local/etc/mosquitto/certs && \
41    install -d /var/lib/mosquitto && \
42    install -s -m755 /mosquitto/client/mosquitto_pub \
43	       /usr/local/bin/mosquitto_pub && \
44    install -s -m755 /mosquitto/client/mosquitto_rr \
45	       /usr/local/bin/mosquitto_rr && \
46    install -s -m755 /mosquitto/client/mosquitto_sub \
47	       /usr/local/bin/mosquitto_sub && \
48    install -s -m644 /mosquitto/lib/libmosquitto.so.1 \
49	       /usr/local/lib/libmosquitto.so.1 && \
50    install -s -m755 /mosquitto/src/mosquitto /usr/local/sbin/mosquitto && \
51    install -s -m755 /mosquitto/src/mosquitto_passwd \
52	       /usr/local/bin/mosquitto_passwd && \
53    rm -rf /mosquitto; \
54    addgroup --system mosquitto && \
55    adduser --system \
56	    --no-create-home \
57	    --disabled-password \
58	    --disabled-login \
59	    --ingroup mosquitto \
60	    mosquitto
61
62COPY mosquitto.conf mosquitto-tls.conf /usr/local/etc/mosquitto/
63
64# Simple Python based HTTP server for http-client API testing
65# The http-get-file-test.sh is used for testing TCP with dumb-http-server-mt
66# network sample.
67# The syslog-receiver.py will test syslog-net sample
68COPY http-server.py https-server.py http-get-file-test.sh \
69     syslog-receiver.py connectivity-check.sh /usr/local/bin/
70COPY http-get-file-test.sh /usr/local/bin/https-get-file-test.sh
71
72# Dante is SOCKS proxy. The gptp.conf is conf file for linuxptp.
73COPY danted.conf gptp.cfg /etc/
74
75# Leshan demo server
76RUN cd /net-tools && \
77    curl 'https://repo1.maven.org/maven2/org/eclipse/leshan/leshan-server-demo/2.0.0-M14/leshan-server-demo-2.0.0-M14-jar-with-dependencies.jar' -o leshan-server-demo.jar && \
78    curl 'https://repo1.maven.org/maven2/org/eclipse/leshan/leshan-bsserver-demo/2.0.0-M14/leshan-bsserver-demo-2.0.0-M14-jar-with-dependencies.jar' -o leshan-bsserver-demo.jar
79
80# DNS resolver to test online connectivity checker
81COPY dnsmasq.conf /etc/
82
83WORKDIR /net-tools
84
85# We do not run any command automatically but let the test script run
86# the proper test application script.
87