forked from chuanjin/docker-mosquitto-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-mosquitto
More file actions
52 lines (42 loc) · 2.14 KB
/
Dockerfile-mosquitto
File metadata and controls
52 lines (42 loc) · 2.14 KB
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
48
49
50
51
FROM alpine:3.4
MAINTAINER Kerem Bilgicer <krmbil@gmail.com>
EXPOSE 1883
EXPOSE 1884
RUN addgroup -S mosquitto && \
adduser -S -H -h /var/empty -s /sbin/nologin -D -G mosquitto mosquitto
RUN mkdir -p /srv/mqtt/data/
RUN chmod -R 777 /srv/mqtt/data
ENV PATH=/usr/local/bin:/usr/local/sbin:$PATH
ENV MOSQUITTO_VERSION=1.4.14
COPY docker-entrypoint.sh /
COPY wait-for-postgres.sh /
RUN buildDeps='git alpine-sdk openssl-dev libwebsockets-dev c-ares-dev util-linux-dev postgresql-dev hiredis-dev curl-dev libxslt docbook-xsl'; \
chmod +x /docker-entrypoint.sh && \
chmod +x /wait-for-postgres.sh && \
apk update && \
apk add --no-cache $buildDeps libpq postgresql-client hiredis libwebsockets libuuid c-ares openssl curl ca-certificates && \
wget http://mosquitto.org/files/source/mosquitto-${MOSQUITTO_VERSION}.tar.gz && \
tar xzfv mosquitto-${MOSQUITTO_VERSION}.tar.gz && \
mv mosquitto-${MOSQUITTO_VERSION} mosquitto && \
cd mosquitto && \
sed -i -e "s|(INSTALL) -s|(INSTALL)|g" -e 's|--strip-program=${CROSS_COMPILE}${STRIP}||' */Makefile */*/Makefile && \
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/BACKEND_POSTGRES ?= no/BACKEND_POSTGRES ?= yes/" config.mk && \
sed -i "s/BACKEND_MYSQL ?= yes/BACKEND_MYSQL ?= no/" config.mk && \
sed -i "s/MOSQUITTO_SRC =/MOSQUITTO_SRC = ..\//" config.mk && \
sed -i "s/CFG_CFLAGS =/CFG_CFLAGS = -DRAW_SALT/" 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/*
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["mosquitto", "-c", "/etc/mosquitto/mosquitto.conf"]