From b94fbc891a6cd00b949276ccff2d25e7e03be1ed Mon Sep 17 00:00:00 2001 From: Sthope Date: Sun, 15 May 2022 15:57:21 +0200 Subject: [PATCH] first commit --- Dockerfile | 18 +++++++++++++----- root/etc/cont-init.d/10-setup | 8 ++++---- root/etc/services.d/mosquitto/run | 4 ++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 699f0b8..d71ebfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -# FROM alpine:latest -FROM alpine:3.9 +FROM alpine:latest + +ARG S6_OVERLAY_VERSION=3.1.0.1 + LABEL org.opencontainers.image.source="https://git.sthope.dev/sthope/DockerContainer-randomPwd" LABEL Maintainer="Sthope" @@ -14,7 +16,13 @@ RUN set -xe \ && adduser -u ${PUID} -G mosquitto -h /mosquitto/ -D mosquitto \ && apk add --no-cache --purge -uU mosquitto mosquitto-libs mosquitto-clients -WORKDIR /workspace -COPY root/defaults/temp2mqtt /workspace +WORKDIR /config +# COPY root/defaults/temp2mqtt /config -CMD [ "sh", "./temp2mqtt" ] \ No newline at end of file +# 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"] \ No newline at end of file diff --git a/root/etc/cont-init.d/10-setup b/root/etc/cont-init.d/10-setup index 2f3164a..f2ccd86 100755 --- a/root/etc/cont-init.d/10-setup +++ b/root/etc/cont-init.d/10-setup @@ -7,8 +7,8 @@ PROXMOX_NAME="${PROXMOX_NAME:-pve}"; TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g'); -[[ ! -f /mosquitto/config/temp2mqtt ]] && touch /mosquitto/config/temp2mqtt; -cat <> /mosquitto/config/temp2mqtt +[[ ! -f /config/temp2mqtt ]] && touch /config/temp2mqtt; +cat <> /config/temp2mqtt #!/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}" EOF -chown -R mosquitto:mosquitto /mosquitto/; -chmod +x /mosquitto/config/temp2mqtt; \ No newline at end of file +chown -R mosquitto:mosquitto /config/temp2mqtt; +chmod +x /config/temp2mqtt; \ No newline at end of file diff --git a/root/etc/services.d/mosquitto/run b/root/etc/services.d/mosquitto/run index 3648198..0658bb9 100644 --- a/root/etc/services.d/mosquitto/run +++ b/root/etc/services.d/mosquitto/run @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -cd /mosquitto/config || exit 1; +cd /config/ || exit 1; -while /mosquitto/config/temp2mqtt; do sleep 10; done \ No newline at end of file +while /config/temp2mqtt; do sleep 10; done \ No newline at end of file