Last active
August 29, 2015 14:26
-
-
Save hilios/6dfb40bf6b716ac97619 to your computer and use it in GitHub Desktop.
Build mosquitto from source for Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
MAINTAINER Edson Hilios <edson.hilios.com.br> | |
RUN apt-get update -y | |
RUN apt-get install -y wget | |
# Install libwebsockets | |
RUN apt-get install -y cmake libssl-dev | |
RUN mkdir -p /build/libwebsockets | |
WORKDIR /build/libwebsockets | |
RUN wget http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/snapshot/libwebsockets-1.4-chrome43-firefox-36.tar.gz | |
RUN tar --strip-components=1 -xzvf libwebsockets-1.4-chrome43-firefox-36.tar.gz | |
RUN cmake . | |
RUN make | |
RUN make install | |
# Install mosquitto | |
RUN apt-get install -y g++ python uuid-dev libc-ares-dev libwrap0-dev xsltproc docbook-xsl | |
RUN mkdir -p /build/mosquitto | |
WORKDIR /build/mosquitto | |
RUN wget http://git.eclipse.org/c/mosquitto/org.eclipse.mosquitto.git/snapshot/org.eclipse.mosquitto-1.4.2.tar.gz | |
RUN tar --strip-components=1 -xzvf org.eclipse.mosquitto-1.4.2.tar.gz | |
RUN sed -ie "s/WITH_WEBSOCKETS:=no/WITH_WEBSOCKETS:=yes/" config.mk | |
RUN make | |
RUN make install | |
RUN useradd -r -m -d /var/lib/mosquitto -s /usr/sbin/nologin -g nogroup mosquitto | |
RUN cp /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf | |
RUN sed -ie "s/#pid_file/pid_file \/var\/run\/mosquitto.pid/" | |
# Everything ready | |
VOLUME ["/etc/mosquitto", "/var/lib/mosquitto"] | |
WORKDIR /etc/mosquitto | |
#EXPOSE 1883 8883 8884 8080 8081 | |
CMD ["/usr/local/sbin/mosquitto", "-c", "/etc/mosquitto/mosquitto.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pid_file /var/run/mosquitto.pid | |
persistent_client_expiration 1m | |
persistence true | |
persistence_file mosquitto.db | |
persistence_location /etc/mosquitto/ | |
port 1883 | |
protocol mqtt | |
listener 8080 | |
protocol websockets | |
allow_anonymous false | |
password_file /etc/mosquitto/.passwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment