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
14# We need the net-tools project as it contains helper apps needed
15# in testing.
16RUN git clone https://github.com/zephyrproject-rtos/net-tools.git && \
17    cd /net-tools && \
18    make tunslip6 && make echo-client && \
19    make echo-server && make throughput-client && \
20    make coap-client
21
22# linuxptp daemon is needed in gPTP testing
23RUN git clone https://git.code.sf.net/p/linuxptp/code linuxptp && \
24    cd /linuxptp && \
25    git checkout v3.1 && \
26    make && \
27    make install
28
29# MQTT testing
30RUN git clone https://github.com/eclipse/mosquitto.git && \
31    cd /mosquitto && \
32    git checkout v1.6.9 && \
33    make binary && \
34    install -d /usr/local/bin/ && \
35    install -d /usr/local/sbin/ && \
36    install -d /usr/local/lib/ && \
37    install -d /usr/local/etc/mosquitto/certs && \
38    install -d /var/lib/mosquitto && \
39    install -s -m755 /mosquitto/client/mosquitto_pub \
40	       /usr/local/bin/mosquitto_pub && \
41    install -s -m755 /mosquitto/client/mosquitto_rr \
42	       /usr/local/bin/mosquitto_rr && \
43    install -s -m755 /mosquitto/client/mosquitto_sub \
44	       /usr/local/bin/mosquitto_sub && \
45    install -s -m644 /mosquitto/lib/libmosquitto.so.1 \
46	       /usr/local/lib/libmosquitto.so.1 && \
47    install -s -m755 /mosquitto/src/mosquitto /usr/local/sbin/mosquitto && \
48    install -s -m755 /mosquitto/src/mosquitto_passwd \
49	       /usr/local/bin/mosquitto_passwd && \
50    rm -rf /mosquitto; \
51    addgroup --system mosquitto && \
52    adduser --system \
53	    --no-create-home \
54	    --disabled-password \
55	    --disabled-login \
56	    --ingroup mosquitto \
57	    mosquitto
58
59COPY mosquitto.conf mosquitto-tls.conf /usr/local/etc/mosquitto/
60
61# Simple Python based HTTP server for http-client API testing
62# The http-get-file-test.sh is used for testing TCP with dumb-http-server-mt
63# network sample.
64# The syslog-receiver.py will test syslog-net sample
65COPY http-server.py https-server.py http-get-file-test.sh \
66     syslog-receiver.py /usr/local/bin/
67COPY http-get-file-test.sh /usr/local/bin/https-get-file-test.sh
68
69# Dante is SOCKS proxy. The gptp.conf is conf file for linuxptp.
70COPY danted.conf gptp.cfg /etc/
71
72# Leshan demo server
73RUN cd /net-tools && \
74    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 && \
75    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
76
77WORKDIR /net-tools
78
79# We do not run any command automatically but let the test script run
80# the proper test application script.
81