Skip to content

Commit

Permalink
mosquitto base update
Browse files Browse the repository at this point in the history
  • Loading branch information
suculent committed Mar 18, 2024
1 parent 6d5b436 commit 970d2ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
24 changes: 12 additions & 12 deletions services/broker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
# the automatically built images
ARG MOSQUITTO_VERSION=2.0.15
# Define libwebsocket version
ARG LWS_VERSION=4.2.2
ARG LWS_VERSION=4.3.3

# Use debian:stable-slim as a builder for Mosquitto and dependencies.
FROM debian:stable-slim as mosquitto_builder
FROM debian:trixie-slim as mosquitto_builder
ARG MOSQUITTO_VERSION
ARG LWS_VERSION

# Get mosquitto build dependencies.
RUN set -ex; \
apt-get update; \
apt-get install -y wget build-essential cmake libssl-dev libcjson-dev
RUN apt-get update && apt-get install -y --no-install-recommends wget build-essential cmake libssl-dev libcjson-dev ca-certificates

# Get libwebsocket. Debian's libwebsockets is too old for Mosquitto version > 2.x so it gets built from source.
RUN set -ex; \
Expand Down Expand Up @@ -49,7 +47,7 @@ RUN tar xzvf mosquitto-${MOSQUITTO_VERSION}.tar.gz
RUN set -ex; \
cd mosquitto-${MOSQUITTO_VERSION}; \
make CFLAGS="-Wall -O2 -I/build/lws/include" LDFLAGS="-L/build/lws/lib" WITH_WEBSOCKETS=yes; \
make install;
make install

# Use golang:latest as a builder for the Mosquitto Go Auth plugin.
FROM golang:latest AS go_auth_builder
Expand All @@ -71,13 +69,13 @@ RUN set -ex; \
if [ ! -z "$TARGETPLATFORM" ]; then \
case "$TARGETPLATFORM" in \
"linux/arm64") \
apt update && apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
apt-get update && apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
;; \
"linux/arm/v7") \
apt update && apt install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \
apt-get update && apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \
;; \
"linux/arm/v6") \
apt update && apt install -y gcc-arm-linux-gnueabihf libc6-dev-armel-cross libc6-dev-armhf-cross \
apt-get update && apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armel-cross libc6-dev-armhf-cross \
;; \
esac \
fi
Expand All @@ -87,16 +85,18 @@ COPY --from=mosquitto_builder /usr/local/include/ /usr/local/include/

COPY ./goauth ./
RUN set -ex; \
go get -u ./...; \
go mod tidy; \
go build -buildmode=c-archive go-auth.go; \
go build -buildmode=c-shared -o go-auth.so; \
go build pw-gen/pw.go

#Start from a new image.
FROM debian:stable-slim
FROM debian:trixie-slim

RUN set -ex; \
apt update; \
apt install -y libc-ares2 openssl uuid tini wget libssl-dev libcjson-dev
apt-get update; \
apt-get install -y --no-install-recommends libc-ares2 openssl uuid tini wget libssl-dev libcjson-dev

RUN mkdir -p /var/lib/mosquitto /var/log/mosquitto
RUN set -ex; \
Expand Down
21 changes: 10 additions & 11 deletions services/broker/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
FROM thinxcloud/mosquitto

LABEL name="thinxcloud/mosquitto" version="1.5.8"

RUN apt-get update --fix-missing \
&& apt-get install -y software-properties-common
LABEL name="thinxcloud/mosquitto" version="2.0.15"

# for early testing
RUN wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key \
&& apt-key add mosquitto-repo.gpg.key \
&& cd /etc/apt/sources.list.d/ && wget http://repo.mosquitto.org/debian/mosquitto-buster.list \
&& apt-add-repository ppa:mosquitto-dev/mosquitto-ppa \
&& apt-get update \
&& apt-get install mosquitto-clients \
&& apt clean
RUN apt install -y mosquitto-clients

# mock directory structure for mosquitto data
COPY ./test/mosquitto/mosquitto.conf /etc/mosquitto/mosquitto.conf

# this must happen in the run-script!!! othervise env-var can not be externalized; happens only in test of files backend
#RUN mkdir -p /mqtt/auth && \
# PASS=$(/mosquitto/pw -h bcrypt -c 10 -p mosquitto) && \
# echo "thinx:${PASS}" > /mqtt/auth/thinx.pw && \
# echo "Written thinx:${PASS} to /mqtt/auth/thinx.pw" && \
# cat /mqtt/auth/thinx.pw

COPY ./test/mosquitto/auth/thinx.acl /mqtt/auth/thinx.acl

0 comments on commit 970d2ac

Please sign in to comment.