-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
48 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
FROM alpine:3.8 | ||
|
||
LABEL maintainer="Roger Light <[email protected]>" \ | ||
description="Eclipse Mosquitto MQTT Broker" | ||
description="Eclipse Mosquitto MQTT Broker" | ||
|
||
ENV VERSION=1.5.3 \ | ||
DOWNLOAD_SHA256=3081a998d303a883b1cd064009beabc88aa9159e26f5258a4ae6007160491d10 \ | ||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ | ||
LWS_VERSION=2.4.2 | ||
DOWNLOAD_SHA256=3081a998d303a883b1cd064009beabc88aa9159e26f5258a4ae6007160491d10 \ | ||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ | ||
LWS_VERSION=2.4.2 | ||
|
||
RUN set -x && \ | ||
apk --no-cache add --virtual build-deps \ | ||
build-base \ | ||
cmake \ | ||
gnupg \ | ||
libressl-dev \ | ||
util-linux-dev && \ | ||
apk --no-cache add --virtual build-deps \ | ||
build-base \ | ||
cmake \ | ||
gnupg \ | ||
libressl-dev \ | ||
util-linux-dev && \ | ||
wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \ | ||
mkdir -p /build/lws && \ | ||
tar --strip=1 -xf /tmp/lws.tar.gz -C /build/lws && \ | ||
|
@@ -34,51 +34,51 @@ RUN set -x && \ | |
make -j "$(nproc)" && \ | ||
rm -rf /root/.cmake && \ | ||
wget https://mosquitto.org/files/source/mosquitto-${VERSION}.tar.gz -O /tmp/mosq.tar.gz && \ | ||
echo "$DOWNLOAD_SHA256 /tmp/mosq.tar.gz" | sha256sum -c - && \ | ||
echo "$DOWNLOAD_SHA256 /tmp/mosq.tar.gz" | sha256sum -c - && \ | ||
wget https://mosquitto.org/files/source/mosquitto-${VERSION}.tar.gz.asc -O /tmp/mosq.tar.gz.asc && \ | ||
export GNUPGHOME="$(mktemp -d)" && \ | ||
found=''; \ | ||
for server in \ | ||
ha.pool.sks-keyservers.net \ | ||
hkp:https://keyserver.ubuntu.com:80 \ | ||
hkp:https://p80.pool.sks-keyservers.net:80 \ | ||
pgp.mit.edu \ | ||
; do \ | ||
echo "Fetching GPG key $GPG_KEYS from $server"; \ | ||
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \ | ||
done; \ | ||
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \ | ||
gpg --batch --verify /tmp/mosq.tar.gz.asc /tmp/mosq.tar.gz && \ | ||
gpgconf --kill all && \ | ||
rm -rf "$GNUPGHOME" /tmp/mosq.tar.gz.asc && \ | ||
mkdir -p /build/mosq && \ | ||
tar --strip=1 -xf /tmp/mosq.tar.gz -C /build/mosq && \ | ||
rm /tmp/mosq.tar.gz && \ | ||
export GNUPGHOME="$(mktemp -d)" && \ | ||
found=''; \ | ||
for server in \ | ||
ha.pool.sks-keyservers.net \ | ||
hkp:https://keyserver.ubuntu.com:80 \ | ||
hkp:https://p80.pool.sks-keyservers.net:80 \ | ||
pgp.mit.edu \ | ||
; do \ | ||
echo "Fetching GPG key $GPG_KEYS from $server"; \ | ||
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \ | ||
done; \ | ||
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \ | ||
gpg --batch --verify /tmp/mosq.tar.gz.asc /tmp/mosq.tar.gz && \ | ||
gpgconf --kill all && \ | ||
rm -rf "$GNUPGHOME" /tmp/mosq.tar.gz.asc && \ | ||
mkdir -p /build/mosq && \ | ||
tar --strip=1 -xf /tmp/mosq.tar.gz -C /build/mosq && \ | ||
rm /tmp/mosq.tar.gz && \ | ||
make -C /build/mosq -j "$(nproc)" \ | ||
CFLAGS="-Wall -O2 -I/build/lws/include -flto" \ | ||
LDFLAGS="-L/build/lws/lib -flto" \ | ||
WITH_ADNS=no \ | ||
WITH_DOCS=no \ | ||
WITH_MEMORY_TRACKING=no \ | ||
WITH_SHARED_LIBRARIES=no \ | ||
WITH_SRV=no \ | ||
WITH_STRIP=yes \ | ||
WITH_TLS_PSK=no \ | ||
WITH_WEBSOCKETS=yes \ | ||
prefix=/usr \ | ||
binary && \ | ||
addgroup -S mosquitto 2>/dev/null && \ | ||
WITH_ADNS=no \ | ||
WITH_DOCS=no \ | ||
WITH_MEMORY_TRACKING=no \ | ||
WITH_SHARED_LIBRARIES=no \ | ||
WITH_SRV=no \ | ||
WITH_STRIP=yes \ | ||
WITH_TLS_PSK=no \ | ||
WITH_WEBSOCKETS=yes \ | ||
prefix=/usr \ | ||
binary && \ | ||
addgroup -S mosquitto 2>/dev/null && \ | ||
adduser -S -D -H -h /var/empty -s /sbin/nologin -G mosquitto -g mosquitto mosquitto 2>/dev/null && \ | ||
mkdir -p /mosquitto/config /mosquitto/data /mosquitto/log && \ | ||
install -d /usr/sbin/ && \ | ||
install -s -m755 /build/mosq/src/mosquitto /usr/sbin/mosquitto && \ | ||
install -s -m755 /build/mosq/src/mosquitto_passwd /usr/bin/mosquitto_passwd && \ | ||
install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ | ||
install -d /usr/sbin/ && \ | ||
install -s -m755 /build/mosq/src/mosquitto /usr/sbin/mosquitto && \ | ||
install -s -m755 /build/mosq/src/mosquitto_passwd /usr/bin/mosquitto_passwd && \ | ||
install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \ | ||
chown -R mosquitto:mosquitto /mosquitto && \ | ||
apk --no-cache add \ | ||
libuuid && \ | ||
apk del build-deps && \ | ||
rm -rf /build | ||
apk --no-cache add \ | ||
libuuid && \ | ||
apk del build-deps && \ | ||
rm -rf /build | ||
|
||
VOLUME ["/mosquitto/data", "/mosquitto/log"] | ||
|
||
|