This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
forked from jllopis/docker-mosquitto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (40 loc) · 2.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM alpine:3.4
EXPOSE 1883
EXPOSE 9883
VOLUME ["/var/lib/mosquitto", "/etc/mosquitto", "/etc/mosquitto.d"]
RUN addgroup -S mosquitto && \
adduser -S -H -h /var/empty -s /sbin/nologin -D -G mosquitto mosquitto
ENV PATH=/usr/local/bin:/usr/local/sbin:$PATH
ENV MOSQUITTO_VERSION=v1.4.10
COPY run.sh /
RUN buildDeps='git alpine-sdk openssl-dev libwebsockets-dev c-ares-dev util-linux-dev hiredis-dev curl-dev libxslt docbook-xsl mariadb-dev'; \
chmod +x /run.sh && \
mkdir -p /var/lib/mosquitto && \
touch /var/lib/mosquitto/.keep && \
mkdir -p /etc/mosquitto.d && \
apk update && \
apk add $buildDeps hiredis libwebsockets libuuid c-ares openssl curl ca-certificates mariadb-client-libs && \
git clone https://github.com/eclipse/mosquitto.git && \
cd mosquitto && \
git checkout ${MOSQUITTO_VERSION} -b ${MOSQUITTO_VERSION} && \
sed -i -e "s|(INSTALL) -s|(INSTALL)|g" -e 's|--strip-program=${CROSS_COMPILE}${STRIP}||' */Makefile */*/Makefile && \
sed -i "s@/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl@/usr/share/xml/docbook/xsl-stylesheets-1.79.1/manpages/docbook.xsl@" man/manpage.xsl && \
# wo WITH_MEMORY_TRACKING=no, mosquitto segfault after receiving first message
make WITH_MEMORY_TRACKING=no WITH_SRV=yes WITH_WEBSOCKETS=yes && \
make install && \
git clone git://github.com/jpmens/mosquitto-auth-plug.git && \
cd mosquitto-auth-plug && \
cp config.mk.in config.mk && \
sed -i "s/BACKEND_REDIS ?= no/BACKEND_REDIS ?= yes/" config.mk && \
sed -i "s/BACKEND_HTTP ?= no/BACKEND_HTTP ?= yes/" config.mk && \
sed -i "s/MOSQUITTO_SRC =/MOSQUITTO_SRC = ..\//" config.mk && \
sed -i "s/EVP_MD_CTX_new/EVP_MD_CTX_create/g" cache.c && \
sed -i "s/EVP_MD_CTX_free/EVP_MD_CTX_destroy/g" cache.c && \
make && \
cp auth-plug.so /usr/local/lib/ && \
cp np /usr/local/bin/ && chmod +x /usr/local/bin/np && \
cd / && rm -rf mosquitto && \
apk del $buildDeps && rm -rf /var/cache/apk/*
ADD mosquitto.conf /etc/mosquitto/mosquitto.conf
ENTRYPOINT ["/run.sh"]
CMD ["mosquitto"]