first commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sthope 2022-05-15 15:57:21 +02:00
parent a872c40919
commit b94fbc891a
3 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,7 @@
# FROM alpine:latest FROM alpine:latest
FROM alpine:3.9
ARG S6_OVERLAY_VERSION=3.1.0.1
LABEL org.opencontainers.image.source="https://git.sthope.dev/sthope/DockerContainer-randomPwd" LABEL org.opencontainers.image.source="https://git.sthope.dev/sthope/DockerContainer-randomPwd"
LABEL Maintainer="Sthope" LABEL Maintainer="Sthope"
@ -14,7 +16,13 @@ RUN set -xe \
&& adduser -u ${PUID} -G mosquitto -h /mosquitto/ -D mosquitto \ && adduser -u ${PUID} -G mosquitto -h /mosquitto/ -D mosquitto \
&& apk add --no-cache --purge -uU mosquitto mosquitto-libs mosquitto-clients && apk add --no-cache --purge -uU mosquitto mosquitto-libs mosquitto-clients
WORKDIR /workspace WORKDIR /config
COPY root/defaults/temp2mqtt /workspace # COPY root/defaults/temp2mqtt /config
CMD [ "sh", "./temp2mqtt" ] # CMD [ "sh", "./temp2mqtt" ]
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
ENTRYPOINT ["/init"]

View File

@ -7,8 +7,8 @@ PROXMOX_NAME="${PROXMOX_NAME:-pve}";
TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g'); TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
[[ ! -f /mosquitto/config/temp2mqtt ]] && touch /mosquitto/config/temp2mqtt; [[ ! -f /config/temp2mqtt ]] && touch /config/temp2mqtt;
cat <<EOF >> /mosquitto/config/temp2mqtt cat <<EOF >> /config/temp2mqtt
#!/bin/bash #!/bin/bash
# ___ _ _ _ __ # ___ _ _ _ __
# / __|| |_ | |_ ___ | '_ \ ___ # / __|| |_ | |_ ___ | '_ \ ___
@ -25,5 +25,5 @@ TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
mosquitto_pub -h "${MQTT_BROKER}" -u "${USERNAME}" -P "${PASSWORD}" -t proxmox/"${PROXMOX_NAME}"/cpu_temp -m "${TEMP}" mosquitto_pub -h "${MQTT_BROKER}" -u "${USERNAME}" -P "${PASSWORD}" -t proxmox/"${PROXMOX_NAME}"/cpu_temp -m "${TEMP}"
EOF EOF
chown -R mosquitto:mosquitto /mosquitto/; chown -R mosquitto:mosquitto /config/temp2mqtt;
chmod +x /mosquitto/config/temp2mqtt; chmod +x /config/temp2mqtt;

View File

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
cd /mosquitto/config || exit 1; cd /config/ || exit 1;
while /mosquitto/config/temp2mqtt; do sleep 10; done while /config/temp2mqtt; do sleep 10; done