Skip to content

Commit a1fcd0c

Browse files
pfljukkar
authored andcommitted
docker: Add mosquitto MQTT server to net-tools image
In addition to the already existing net tools, clone mosquitto MQTT server from git, compile and install it. When running the git clone, add any possible proxies as environment variables in both RUN commands, e.g.: RUN https_proxy=proxy.example.net:112 git clone https://... When mosquitto compilation is finished, install it in the Docker image under /usr/local/ and remove the source code and build directory. Mosquitto also needs a user id 'mosquitto'. As multiple FROM directives are not that helpful, count on the gcc image to contain necessary tools and build environment. Signed-off-by: Patrik Flykt <[email protected]>
1 parent 4bff010 commit a1fcd0c

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

docker/Dockerfile

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,47 @@
11
# Create Docker image that can be used for testing Zephyr network
22
# sample applications.
33

4-
FROM fedora
54
FROM gcc
65

7-
# RUN http_proxy=... git clone...
8-
RUN git clone http://github.com/zephyrproject-rtos/net-tools.git && \
6+
# RUN https_proxy=... git clone...
7+
RUN git clone https://github.com/zephyrproject-rtos/net-tools.git && \
98
cd /net-tools && \
109
make tunslip6 && make echo-client && \
1110
make echo-server && make throughput-client && \
1211
make coap-client
1312

13+
# RUN https_proxy=... git clone...
14+
RUN git clone https://github.com/eclipse/mosquitto.git && \
15+
cd /mosquitto && \
16+
git checkout v1.6.9 && \
17+
make binary && \
18+
install -d /usr/local/bin/ && \
19+
install -d /usr/local/sbin/ && \
20+
install -d /usr/local/lib/ && \
21+
install -s -m755 /mosquitto/client/mosquitto_pub \
22+
/usr/local/bin/mosquitto_pub && \
23+
install -s -m755 /mosquitto/client/mosquitto_rr \
24+
/usr/local/bin/mosquitto_rr && \
25+
install -s -m755 /mosquitto/client/mosquitto_sub \
26+
/usr/local/bin/mosquitto_sub && \
27+
install -s -m644 /mosquitto/lib/libmosquitto.so.1 \
28+
/usr/local/lib/libmosquitto.so.1 && \
29+
install -s -m755 /mosquitto/src/mosquitto /usr/local/sbin/mosquitto && \
30+
install -s -m755 /mosquitto/src/mosquitto_passwd \
31+
/usr/local/bin/mosquitto_passwd && \
32+
rm -rf /mosquitto
33+
34+
RUN addgroup --system mosquitto && \
35+
adduser --system \
36+
--no-create-home \
37+
--disabled-password \
38+
--disabled-login \
39+
--ingroup mosquitto \
40+
mosquitto
41+
42+
COPY mosquitto.conf /usr/local/etc/
43+
COPY mosquitto-tls.conf /usr/local/etc/
44+
1445
WORKDIR /net-tools
1546

1647
# We do not run any command automatically but let the test script run

docker/mosquitto.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Place your local configuration in /etc/mosquitto/conf.d/
2+
#
3+
# A full description of the configuration file is at
4+
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
5+
6+
pid_file /var/run/mosquitto.pid
7+
8+
persistence true
9+
persistence_location /var/lib/mosquitto/

0 commit comments

Comments
 (0)