create user in dockerfile, add start script for container
This commit is contained in:
parent
1b83780327
commit
5bf0db7108
@ -3,9 +3,16 @@ FROM debian:latest
|
|||||||
LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
|
LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
|
||||||
LABEL ImageName="registry.gitlab.com/wolutator/mosquitto-with-auth"
|
LABEL ImageName="registry.gitlab.com/wolutator/mosquitto-with-auth"
|
||||||
|
|
||||||
|
ARG MOSQ_USER="mosquitto"
|
||||||
|
ARG MOSQ_UID="1883"
|
||||||
|
ARG MOSQ_GID="1883"
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt update && \
|
apt update && \
|
||||||
apt install -y mariadb-client openssl libwebsockets8
|
apt install -y mariadb-client openssl libwebsockets8 && \
|
||||||
|
groupadd -r -g $MOSQ_GID $MOSQ_USER && \
|
||||||
|
useradd -m -r -u $MOSQ_UID -g $MOSQ_USER $MOSQ_USER
|
||||||
|
|
||||||
|
|
||||||
COPY opt/ /opt
|
COPY opt/ /opt
|
||||||
COPY etc/ /opt/etc
|
COPY etc/ /opt/etc
|
||||||
|
19
mosquitto-start.sh
Executable file
19
mosquitto-start.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
IMAGE=registry.gitlab.com/wolutator/mosquitto-with-auth:latest
|
||||||
|
VOLUME=mosquitto-config
|
||||||
|
|
||||||
|
docker volume inspect $VOLUME > /dev/null || docker volume create $VOLUME
|
||||||
|
|
||||||
|
docker pull $IMAGE
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
-it \
|
||||||
|
--rm \
|
||||||
|
-p1883:1883 \
|
||||||
|
-v $VOLUME:/opt/etc/mosquitto \
|
||||||
|
--link mariadb \
|
||||||
|
--name mosquitto \
|
||||||
|
$IMAGE /bin/bash
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user